Remove blank lines from a file using grep

Contributor Icon Contributed by qmchenry Date Icon September 15, 2003  
Tag Icon Tagged: UNIX


grep -v "^$" filename > newfilename

The ^$ within the quotes is a regular expression: ^=beginning of line, $=end of line, with no characters between.

Previous recipe | Next recipe |
 

Viewing 6 Comments

 
close Reblog this comment
blog comments powered by Disqus