deblank: Turns multiple blank lines into single blank lines
This shell script will go through an ASCII text file and remove multiple blank lines, leave a single blank line. I've added Perl detection of non-ASCII characters in the file so that an external program is not necessary as long as you have Perl available.------------------------------------------------------------- deblank: Turns multiple blank lines into single blank lines ------------------------------------------------------------- Needed a filename (and only one filename) to convert! If more than one filename is given, the second and succeeding files will be ignored. (You may, however, redirect the output to a file). Usage: deblank [filename]
Assume we have a small text file with some blank lines in it. If we want to remove duplicate or multiple blank lines, deblank will do the job.
> more test1 a file with several lines. a file with several lines. a file with several lines. a file with several lines. >deblank test1 a file with several lines. a file with several lines. a file with several lines. a file with several lines.