From jerryc@bnr.ca Tue Jan 21 05:43:33 1997 Path: fu-berlin.de!news.mathworks.com!news.sprintlink.net!news-peer.sprintlink.net!arclight.uoregon.edu!news.bc.net!torn!nott!bcarh189.bnr.ca!crchh327.rich.bnr.ca!jerryc From: jerryc@bnr.ca (Jerry Crawford) Newsgroups: comp.editors,comp.unix.questions,comp.unix.shell Subject: Re: Removing blank lines from a file. Followup-To: comp.editors,comp.unix.questions,comp.unix.shell Date: 7 Jan 1997 14:52:15 GMT Organization: Bell-Northern Research, Richardson, TX Lines: 30 Distribution: inet Message-ID: <5atnuv$46c@crchh327.rich.bnr.ca> References: <1997Jan7.122047.7442@queens-belfast.ac.uk> NNTP-Posting-Host: carphc5f.rich.bnr.ca X-Newsreader: TIN [version 1.2 PL2] Xref: fu-berlin.de comp.editors:22466 comp.unix.questions:94556 comp.unix.shell:45440 : I'd like to find a non-manual way (using vi or shell commands only) to: : (1) Delete all the blank lines. Should be simple eh? I can't find a way! : (2) Ideally, (and this is probably too hopeful without writing a program : to help me), I'd like to rearrange the file to read: You can use either of the following to remove those pesky emptylines from a file: Sed sed '/^$/d' oldfile > newfile or Ex ex oldfile << eof g/^[[: :]]*$/d wq eof -- Jerry Crawford Member of Scientific Staff MCI Customer Acceptance Support/3 Bell Northern Research Richardson, Texas jerryc@bnr.ca