perl -e'while (<>) { foreach ($_) { chomp; s/^\s+//; s/\s+$//; next unless length ; print $_."\n" }}' sample > sample.nospace
Or you could use the -n perl command-line option, which does the loop for you: perl -ne's/^\s+//;s/\s+$//;print $_ unless length;'See man perlrun.
Or you could use the -n perl command-line option, which does the loop for you:
ReplyDeleteperl -ne's/^\s+//;s/\s+$//;print $_ unless length;'
See man perlrun.