Re: Getting a text file rid of all superfluous blank lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthew Saltzman wrote:
On Wed, 30 Nov 2005, Paul Howarth wrote:

Paul Smith wrote:

On 11/30/05, Paul Howarth <paul@xxxxxxxxxxxx> wrote:

Taking a text file, how can one eliminate at once all superfluous blank lines?


What is your definition of a "superfluous blank line"? Is that all blank lines, or all consecutive blank lines where the number is more than one?

If it's the latter, you may find "more -s filename" to your liking.



Thanks, Paul. I mean "all consecutive blank lines where the number is
more than one". Furthermore, I mean how to delete those blank lines
from the file.


$ more -s file > file.new
$ mv file.new file

Paul


Or better, "cat -s file > file.new" and avoid having to page through the file.

You only have to page through a file when output is a terminal (not in this case) IIRC.

Paul.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux