cat filename | perl -ne 's/^\s*\n$//; print;'
Notes
- Replace filename with the path of the file from which you want to remove blank lines.
- You can optionally redirect the output by using '>' operator to create a new file.
This blog has content related to Linux, Apache, MySQL, PHP, Perl, CSS, JavaScript and Free software/open source.
1 comment:
Better way of doing the same thing :-)
cat filename | perl -ne 'next if /^\s*$/; print;'
Post a Comment