From epement@ripco.com Fri May 22 21:36:50 1998 Path: fu-berlin.de!howland.erols.net!feed2.news.erols.com!erols!tezcat!gail.ripco.com!epement From: epement@ripco.com (Eric Pement) Newsgroups: comp.editors Subject: Re: SED question Date: 21 May 1998 05:13:53 GMT Organization: Ripco, Chicago's Oldest Online Information Service Lines: 16 Message-ID: <6k0d6h$qce$2@gail.ripco.com> References: <1103_895688769@ramirez_netlag> NNTP-Posting-Host: lawson.ripco.com X-Newsreader: TIN [version 1.2 PL2] Xref: fu-berlin.de comp.editors:31334 stegri@rocketmail.com wrote: : Does anybody know if it is possible to "join" two lines in SED? : Eg. sed -e "s/\n//g" file.txt only this doesn't work. Yes, of course it's possible. But since sed only works on one line at a time, you first have to get two lines (or more) into the pattern space. For this, you need the N command. # find a line containing "foo"; get the Next line; delete # the intervening newline between them; print the long line sed -e '/foo/{N; s/\n//;}' file.txt -- Eric Pement