Re: to remove leading and trailing blank lines
"RAKESH" <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
Note: blank line => /^$/ i.e., one which has no characters, not even spaces &/or TABs in it. sed -e ' # delete all leading blank lines /./,$!d /./b # accumulate a bunch of consecutive blank lines # then delete that bunch only if u run out of lines. :a $d N /\n\n*$/ba ' yourfile HTH --- In [email protected], "contact2vikas" <contact2vikas@...> wrote: > > Hello, > I want to remove/delete leading and trailing blank lines from a file. > > Vikas >