Getting a text file rid of all superfluous blank lines
Rodolfo Alcazar
rodolfo.alcazar at padep.org.bo
Wed Nov 30 13:33:43 UTC 2005
On Wed, 2005-11-30 at 12:42 +0000, Paul Smith wrote:
> On 11/30/05, Tim <ignored_mailbox at yahoo.com.au> wrote:
> $ more file1.txt
> word1
>
>
>
> word2
>
> word3
> $ more -s file1.txt > file2.txt
> $ more file2.txt
> word1
>
>
>
> word2
>
> word3
> $
>
> 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?
I did it this way:
cat file1 | grep -v "^[ ]*$"
supposing some lines could have no blanks (regex=/^$/) or some spaces
(regex for any number of spaces=/[ ]*/)
--
Rodolfo Alcazar - rodolfo.alcazar at padep.org.bo
Netzmanager Padep, GTZ
591-70656800, -22417628, LA PAZ, BOLIVIA
http://otbits.blogspot.com
--
Murphy's Law of Thermodynamics:
Things get worse under pressure.
More information about the fedora-list
mailing list