[CS-FSLUG] An easy way to remove blank lines?

Steve McCracken smccrack at hcjb.org.ec
Mon Sep 12 10:35:51 CDT 2005


Jukka wrote:
> 2005/9/12, Josiah Ritchie <jritchie at bible.edu>:
> 
>>This takes into account the possibility that there is 0 or more
>>whitespace characters between the start and end of the line.
>>
>>sed '/^\s*$/d' < index.html > index.html
>>
>>It worked for me. WARNING! It will overwrite your file. backup before
>>you issue this command. Take off the > index.html to have it only output
>>the changes to the screen and not the file.
>>
>>JSR/
> 
> 
> Hi Josiah!
> 
> Your warning was important - for some reason it was not possible to
> use same name for both input and output. Every one of the scripts
> produced blank files until I renamed output file to something else
> than input! But these are fine scripts! Thank you!

I can't remember the switch right now (do a man sed) but there is a 
command line option to do the edit in the same file rather than trying 
to redirect it over the same file.


> 
> Blessings,
> Jukka
> 
> _______________________________________________
> ChristianSource FSLUG mailing list
> Christiansource at ofb.biz
> http://cs.uninetsolutions.com





More information about the Christiansource mailing list