[accessiblelinux] Re: the stream editor?

  • From: <aerospace1028@xxxxxxxxxxx>
  • To: <accessiblelinux@xxxxxxxxxxxxx>
  • Date: Fri, 15 Oct 2010 10:44:24 -0400

Thanks,
I had been digging through the sed manpages and a couple online sed users 
guides: a lot more droll and pedantic.

That does exactly what I wanted to do.  Thanks again:-)

Subject: [accessiblelinux] Re: the stream editor?
From: stormdragon2976@xxxxxxxxx
To: accessiblelinux@xxxxxxxxxxxxx
Date: Thu, 14 Oct 2010 08:29:36 -0400






  
  


Hi,

Yes sed is very powerful and can use regexps. This page is awesome, I refer to 
it for almost all of my sed needs:

http://www-h.eng.cam.ac.uk/help/tpl/unix/sed.html

Funny thing is, the thing you need, double spacing is the first thing in the 
list.

sed G yourfile.txt > doublespaced.txt

Note the page just shows you the sed line, you have to know how to redirect to 
a file etc. if you just do:

sed G yourfile.txt

it will display the file with double spacing, not actually write the file with 
the double spaces, so that's why the > and the new file name. If you try to 
write it to the same file it will erase everything in the file which is 
probably not a good thing lol.

HTH

Storm






-- 
Registered Linux user number 508465:
http://counter.li.org/
My blog, Thoughts of a Dragon:
http://www.stormdragon.us/
Get yourself a Frostbox:
http://www.frostbitesystems.com/








On Thu, 2010-10-14 at 08:04 -0400, aerospace1028@xxxxxxxxxxx wrote:


    Salutations,

    does anyone here have experience using sed, the command-line stream editor? 
 Can sed use regular expressions in the replacement-string?  I'm wading through 
the documentation, but I'm having trouble digesting it all (it's very robust, 
which is good once you master it, but adds to the initial learning curve).

    

    I can find lots of applications to search for regular expressions, but I 
still can't find anything to use regular expressions in the substitution field. 
I want to run through a text file and find every carriage-return (designated 
"$" IN MOST PROGRAMS) and substitute it with two carriage-returns (in 
openoffice, the only place I can do this right now, it has to be "\n\n").

    

    Before I commit myself to learning sed, I wanted to double-check it can do 
what I want it to.

    

    thank you:-) 
                                          

Other related posts: