Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!
Remove all \n in sed
Name: nmf Date: May 6, 2006 at 16:34:38 Pacific OS: mac CPU/Ram: emac Manufacturer/Model: apple
Comment:
I currently have an awk that removes all new lines and works fine, but I'd like to do it in a sed file since everything else is happeing in the sed file. in the sed file I have
Name: James Boothe Date: June 8, 2006 at 12:07:30 Pacific
Reply:
Yes, your solution pulls line2 into the buffer with line1. With two lines in the buffer, sed can "see" and operate on the embedded newline that separates the two lines, but not the newline that inherently ends the buffer. After it finishes processing your command (deletion of the newline), it writes out the now joined line1line2 which is terminated by a newline, then reads line3 into the empty buffer and executes your set of commands again.
For sed to delete ALL newlines, I create a loop that keeps pulling all lines into the buffer. Here are two slightly different versions of that:
Summary: find command is recursive....it will delete all files in your sub directories of /archive as well according to the condition that you have given to it. Anupam ...
Summary: Hi I am using sed in a shell script. I am having problems in using parameters in sed for search and replace. TEST=`grep "'/" source | head -1` sed s/$TEST/string1/g source.txt > target.txt This doesn...