Re: Getting a text file rid of all superfluous blank lines
From: Tim (ignored_mailbox_at_yahoo.com.au)
Date: 11/30/05
- Previous message: Rex Dieter: "Re: KDE issues"
- In reply to: Paul Smith: "Re: Getting a text file rid of all superfluous blank lines"
- Next in thread: Paul Smith: "Re: Getting a text file rid of all superfluous blank lines"
- Reply: Paul Smith: "Re: Getting a text file rid of all superfluous blank lines"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: For users of Fedora Core releases <fedora-list@redhat.com> Date: Thu, 01 Dec 2005 00:23:55 +1030
Tim:
>> I used to know of something that did that (something with various
>> different reformatting options for massaging text files), but I can't
>> think what it was. Quickly looking at the man file for the cat program,
>> you could do something like:
>>
>> cat --squeeze-blank inputfilename -> outputfilename
Paul Smith:
> Thanks, Tim and Paul. Paul's method does not mysteriously work:
>
> $ more file1.txt
> word1
>
>
>
> word2
>
> word3
> $ more -s file1.txt > file2.txt
> $ more file2.txt
> word1
>
>
>
> word2
>
> word3
Hmm, seems to work for me. Both with the "less" and "more" programs, as
well as the "cat" program.
> Tim's way works partially, i.e., many blank lines are in effect
> erased, but some remain. I suspect that the left blank lines are not
> blank lines although they look like blank lines. Can one go further
> with deleting the left "false" blank lines?
In what way do they remain? Can you provide an actual example? (Rather
than an explanation of what's happening.)
What I see is that all consecutive blank lines are replaced by a single
blank line, on the file I tried it with.
e.g. Tested on /etc/selinux/targeted/contexts/files/file_contexts
If you want to remove all blank lines, then perhaps you could use grep.
-- Don't send private replies to my address, the mailbox is ignored. I read messages from the public lists. -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
- Previous message: Rex Dieter: "Re: KDE issues"
- In reply to: Paul Smith: "Re: Getting a text file rid of all superfluous blank lines"
- Next in thread: Paul Smith: "Re: Getting a text file rid of all superfluous blank lines"
- Reply: Paul Smith: "Re: Getting a text file rid of all superfluous blank lines"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]