Just another Perl shrine | |
PerlMonks |
(code) One-liner removes whitespace-only lines from text fileby ybiC (Prior) |
on Dec 19, 2001 at 02:15 UTC ( [id://132953]=CUFP: print w/replies, xml ) | Need Help?? |
Perl one-liner to remove from a text file all lines that contain only whitespace.
Other Ways To Do It (mostly not one-liners) can be found at the thread "How do I remove blank lines from text files?". Hmmm... personally, I like Ovid's example below better than mine. It *does* seem more directly recognizable. perl -i.bak -ne 'print unless /^\s+$/' file.txt
Back to
Cool Uses for Perl
|
|