Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!njin!princeton!phoenix!bernsten From: bernsten@phoenix.Princeton.EDU (Dan Bernstein) Newsgroups: comp.editors Subject: Re: SED Question Message-ID: <7805@phoenix.Princeton.EDU> Date: 18 Apr 89 16:52:46 GMT References: <99289@sun.Eng.Sun.COM> Reply-To: bernsten@phoenix.Princeton.EDU (Dan Bernstein) Distribution: usa Organization: Hmph. Lines: 22 How about (tr 'X\012' '\377X';echo '') | sed 's/XPROMPTXX/X/g' | tr '\377X' 'X\012' | sed -n \$\!p The echo '' to add a blank line and sed -n \$\!p to take it away are necessary because sed can't handle input without a terminating newline. The above commands will delete any three lines with exactly PROMPT, <, and >; I don't remember if that was the original question but this solution is much easier to generalize than the others given, not to mention faster. As usual, since we're dealing with sed, if your original input does not end with a newline then the last line will disappear. If you're worried about this, take away the sed -n \$\!p; then normal inputs will have an extra line on the end and no-newline last lines will not be munched. Of course, both tr and sed will munch nulls, and any 255's will be changed to X's. ---Dan Bernstein, bernsten@phoenix.princeton.edu