Penguin
Note: You are viewing an old revision of this page. View the current version.

__Removing empty lines from a file

perl -ni.bak -e 'print if /\S/' file1 file2

  • i means perl will edit he file in place and save a backup with .bak extension
  • e means execute the code/command in the quotes
  • n read man perlrun

The command will loop through the files you specify and print out the lines (into the file you specified) if they match the RegularExpression /\S/

AddToMe