Mon 9 Jun 2008
If you are like me, at some point you have tried to remove newlines from a file with SED.
I have encountered this many times, the nuance always seems to escape me the next time I need it.
The reason it can’t be done in the manner you are most likely trying (sed ’s/\n//g’ infile > outfile), is because SED operates on one line at a time, and generally ignores the newline character.
An easy way to accomplish this is to use awk, or tr:
awk '{ORS=" "; print $0}' infile > outfile
or
cat infile|tr '\n' ' '
If you are stubborn, and still want to use sed;
sed -n ':a;N;$!ba;s/\n//g;p' infile >outfile
May 3rd, 2010 at 10:05 pm
???????? ?????…
?????????, ????????????? If you are like me, at some point you have tried to remove newlines from a file with SED…..
July 1st, 2010 at 8:43 am
< blockquote >< a href=”http://pillspot.org/”>Pillspot.org. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. High quality pills. Buy pills online< /a >…
Buy:Zovirax.Lumigan.Retin-A.Petcam (Metacam) Oral Suspension.Prednisolone.Prevacid.Human Growth Hormone.Nexium.Zyban.Arimidex.Valtrex.Actos.Synthroid.Mega Hoodia.100% Pure Okinawan Coral Calcium.Accutane….
August 29th, 2010 at 5:30 am
8000 http://srawhidekuyl.03GMCPARTS.US/tag/8000+hi+800/ : 800…
800…
August 29th, 2010 at 4:46 pm
instructions http://schairxexp.copious-systems.com/tag/instructions+futon+Beds/ : futon…
futon…
August 29th, 2010 at 9:27 pm
Values http://hcamp26ws2.ALLSTOCKSPORT.INFO/tag/buyers+coin+Values/ : Values…
coin…