sed'ing out newlines

nmeyers at javalinux.net nmeyers at javalinux.net
Mon Dec 15 12:56:36 EST 2003


On Mon, Dec 15, 2003 at 12:49:34PM -0500, Dan Barrett wrote:
> Folks,
> Can anyone remind me of the proper regexp to feed sed which will cause it to 
> eat newlines off?  I've got a file of newline-separated data which I want to 
> concatenate into one big string.

Is that all you want to do, or are you doing something else in your sed
script? I ask because I think it'll be expensive and slow (I haven't
used sed in awhile, but I think you'll end up having to load the entire
file into its memory). The "tr" utility can remove newlines much more
efficiently:

  tr -d '\012' <infile >outfile

Nathan


> 
> d.
> 
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://www.blu.org/mailman/listinfo/discuss
> 
> 

-- 



More information about the Discuss mailing list