|
Correct!! I forgot about the '*' means 0 or MORE!!!!
sed -e'/^ *$/d' -e'/^$/d'
line1has2dashes_line2has2spaces_line3has2dashes.txt -- --
sed '/^$/d' line1has2dashes_line2has2spaces_line3has2dashes.txt
-- --
sed -e'/^ *$/d' -e'/^$/d'
line1has2dashes_line2hasnewlineonly_line3has2dashes.txt -- --
sed '/^ *$/d' line1has2dashes_line2hasnewlineonly_line3has2dashes.txt
-- --
Wouldn't the expression from that article do exactly that? Since * matches ZERO or more occurrences (as opposed to one or more), wouldn't the sed expression from the IT Jungle article match an empty line as well as one that contains blanks? -- On Wed, 4 Oct 2006, Billy Rowe wrote:Also if you want to additionally remove lines that seem blank but
actually
don't contain "blanks", just a "\n", this should work: sed -e'/^ *$/d' -e'/^$/d' FileWithBlankLines > FileWithoutBlankLines ------ Original Message ------This describes exactly what you're looking for: http://www.itjungle.com/fhg/fhg100406-story02.html . -mark Original Message: Subject: SED on AS400 Does anyone have experience in working with the SED pgm in qshell? If possible, does anyone have any syntax of how it could be used on an
AS400
command line? We have a lot of stmf's from business partners that contain blanks and instead of writing pgm's to remove the blank lines we'd like to use the
SED
pgm, if possible.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.