procmail
[Top] [All Lists]

Re: How to remove multiple newlines

2004-07-16 15:34:50
Toen wij *Dallman* Ross kietelden, kwam er dit uit:
*David* W. Tamkin:

sed '/./,/^$/!d'

  sed -n '/./,/^$/p'


See also sed1line.txt:
   http://sed.sourceforge.net/sed1line.txt
   http://www.student.northpark.edu/pemente/sed/sed1line.txt


 # delete all CONSECUTIVE blank lines from file except the first; also
 # deletes all blank lines from top and end of file (emulates "cat -s")

 sed '/./,/^$/!d'          # method 1, allows 0 blanks at top, 1 at EOF

 sed '/^$/N;/\n$/D'        # method 2, allows 1 blank at top, 0 at EOF

-- 
Grtz, Ruud

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail