Article 874 of comp.editors: Path: arizona!noao!ncar!gatech!bloom-beacon!tut.cis.ohio-state.edu!ucbvax!hplabs!hpda!hpcuhc!smaxwell >From: smaxwell@hpcuhc.HP.COM (Susan Maxwell) Newsgroups: comp.editors Subject: SED Question Message-ID: <2360001@hpcuhc.HP.COM> Date: 11 Apr 89 00:43:33 GMT Organization: Hewlett Packard, Cupertino Lines: 15 Got a sed question for you: I'm creating a sed filter to mask out and delete unwanted characters in a trace file. I'm having trouble with this configuration: LINE I: PROMPT> LINE I+1: > LINE I+2: < Whenever I see this series, I want to delete ALL THREE lines. I can't create a pattern /PROMPT\>\\n\>\\n\ Got a sed question for you: I'm creating a sed filter to mask out and > delete unwanted characters in a trace file. I'm having trouble with this > configuration: > > LINE I: PROMPT> > LINE I+1: > > LINE I+2: < Perhaps try the following (sed can match newlines): sed -e '/^PROMPT>$/{ N N /\n>\n<$/d }' John Rupley uucp: ..{uunet | ucbvax | cmcl2 | hao!ncar!noao}!arizona!rupley!local internet: rupley!local@megaron.arizona.edu (H) 30 Calle Belleza, Tucson AZ 85716 - (602) 325-4533 (O) Dept. Biochemistry, Univ. Arizona, Tucson AZ 85721 - (602) 621-3929 Path: arizona!noao!ncar!unmvax!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!bbn!bbn.com!jgrace From: jgrace@bbn.com (Joe Grace) Newsgroups: comp.editors Subject: Re: SED Question Summary: sed is broken Keywords: sed Message-ID: <38564@bbn.COM> Date: 12 Apr 89 00:11:35 GMT References: <2360001@hpcuhc.HP.COM> Sender: news@bbn.COM Reply-To: jgrace@BBN.COM (Joe Grace) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 47 In article <2360001@hpcuhc.HP.COM> smaxwell@hpcuhc.HP.COM (Susan Maxwell) writes: > >Got a sed question for you: I'm creating a sed filter to mask out and >delete unwanted characters in a trace file. I'm having trouble with this >configuration: > > LINE I: PROMPT> > LINE I+1: > > LINE I+2: < > >Whenever I see this series, I want to delete ALL THREE lines. I can't >create a pattern /PROMPT\>\\n\>\\n\sed won't allow patterns to span lines. Is there a way to do this, without >resorting to awk or ed? > >Susan Maxwell Yes, there is a way to get sed to do this, but you have to be wary of sed's shortcomings. Try: ---- #! /bin/sh (cat trace.out; echo "SomeUniqueID") \ | sed \ -e '/^PROMPT>$/{' \ -e 'N' \ -e '/\nSomeUniqueID$/{;s@\nSomeUniqueID$@@;q;}' \ -e 'N' \ -e '/\nSomeUniqueID$/{;s@\nSomeUniqueID$@@;q;}' \ -e '/^PROMPT>\n>\n<$/d' \ -e '}' \ -e '/^SomeUniqueID$/d' If sed had a way of handling an EOF without quitting, the SomeUniqueID would be unnecessary. As sed is, the SomeUniqueID is used to avoid losing lines which start out the same as your pattern but which do not fully match your pattern --- and which you therefore want to keep. Cheers, = Joe = Joe Grace ARPA: jgrace@bbn.com UUCP: {harvard,husc6,decvax,etc.}!bbn!jgrace Path: arizona!rupley From: rupley@arizona.edu (John Rupley) Newsgroups: comp.editors Subject: Re: SED Question Summary: sed not broken Keywords: sed Message-ID: <10191@megaron.arizona.edu> Date: 12 Apr 89 10:47:42 GMT References: <2360001@hpcuhc.HP.COM> <38564@bbn.COM> Organization: U of Arizona CS Dept, Tucson Lines: 77 In article <38564@bbn.COM>, jgrace@bbn.com (Joe Grace) writes: > In article <2360001@hpcuhc.HP.COM> smaxwell@hpcuhc.HP.COM (Susan Maxwell) writes: > >Got a sed question for you: I'm creating a sed filter to mask out and > >delete unwanted characters in a trace file. I'm having trouble with this > >configuration: > > LINE I: PROMPT> > > LINE I+1: > > > LINE I+2: < > >Whenever I see this series, I want to delete ALL THREE lines. I can't > >create a pattern /PROMPT\>\\n\>\\n\ >sed won't allow patterns to span lines. Is there a way to do this, without > >resorting to awk or ed? > > Yes, there is a way to get sed to do this, but you have to be > wary of sed's shortcomings. > > Try: > ---- > #! /bin/sh > > (cat trace.out; echo "SomeUniqueID") \ > | sed \ > -e '/^PROMPT>$/{' \ > -e 'N' \ > -e '/\nSomeUniqueID$/{;s@\nSomeUniqueID$@@;q;}' \ > -e 'N' \ > -e '/\nSomeUniqueID$/{;s@\nSomeUniqueID$@@;q;}' \ > -e '/^PROMPT>\n>\n<$/d' \ > -e '}' \ > -e '/^SomeUniqueID$/d' > > If sed had a way of handling an EOF without quitting, the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > SomeUniqueID would be unnecessary. As sed is, the SomeUniqueID > is used to avoid losing lines which start out the same as your > pattern but which do not fully match your pattern --- and which > you therefore want to keep. Sed can check for EOF, I believe, and fairly simply, by use of the address "$", for last line of file. The following script should take care of the last line problem, as well as some additional but probably not all other abnormalities. sed -e '/^PROMPT>$/{ : restart /^PROMPT>$/{ h $q N /^PROMPT>\n>$/{ h $q N /^PROMPT>\n>\n<$/d x p x s/^PROMPT>\n>\n// b restart } x p x s/^PROMPT>\n// b restart } }' John Rupley uucp: ..{uunet | ucbvax | cmcl2 | hao!ncar!noao}!arizona!rupley!local internet: rupley!local@megaron.arizona.edu (H) 30 Calle Belleza, Tucson AZ 85716 - (602) 325-4533 (O) Dept. Biochemistry, Univ. Arizona, Tucson AZ 85721 - (602) 621-3929 From local Wed Apr 12 03:59 MST 1989 To: local Subject: Re: SED question Status: RO The following is a posting, in reply to a reply to yours. Not sure if the frills are needed, but the last line problem may be of interest. Incidentally, I think two lines of Lex source would do what you want: %% PROMPT>\n>\n<\n ; .*|\n ECHO; Regards, John R. ---------------------------------------------------------------------------- [delete of repeat of above posting] John Rupley uucp: ..{uunet | ucbvax | cmcl2 | hao!ncar!noao}!arizona!rupley!local internet: rupley!local@megaron.arizona.edu (H) 30 Calle Belleza, Tucson AZ 85716 - (602) 325-4533 (O) Dept. Biochemistry, Univ. Arizona, Tucson AZ 85721 - (602) 621-3929 >From jgrace@BBN.COM Wed Apr 12 09:40:46 1989 Message-Id: <8904121640.AA25488@megaron.arizona.edu> Received: from GOVERNMENT-CENTER.BBN.COM by megaron.arizona.edu (5.59-1.7/15) via SMTP id AA25488; Wed, 12 Apr 89 09:40:00 MST To: rupley@arizona.edu Subject: Re: SED Question Newsgroups: comp.editors In-Reply-To: <10191@megaron.arizona.edu> References: <2360001@hpcuhc.HP.COM> <38564@bbn.COM> Organization: Bolt Beranek and Newman Inc., Cambridge MA Date: Wed, 12 Apr 89 12:21:38 -0400 From: jgrace@BBN.COM Status: R John, you're right. I plead guilty to Bugs and Ignorance. Thanks for the "$" tip. = Joe = -- Joe Grace ARPA: jgrace@bbn.com UUCP: {harvard,husc6,decvax,etc.}!bbn!jgrace Path: arizona!noao!ncar!unmvax!pprg.unm.edu!hc!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.editors,comp.unix.questions Subject: Re^2: SED Question Keywords: sed, improvement, fix Message-ID: <2292@solo11.cs.vu.nl> Date: 12 Apr 89 21:03:59 GMT References: <2360001@hpcuhc.HP.COM> <38564@bbn.COM> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 33 Xref: arizona comp.editors:890 comp.unix.questions:14112 jgrace@bbn.com (Joe Grace) writes: \... \Yes, there is a way to get sed to do this, but you have to be \wary of sed's shortcomings. [shell script workaround deleted] \If sed had a way of handling an EOF without quitting, the \[workaround would be unnecessary] [...] My first sed attempt can easily be fixed to handle partial matches at EOF properly: sed -n ' /^PROMPT>$/{ $p h n H /^>$/{ $b eof n /^<$/b H } : eof g } p ' -- "If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam: it's probably wrong." (jim@bilpin). |maart@cs.vu.nl, mcvax!botter!maart Path: arizona!noao!ncar!unmvax!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!lll-winken!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.editors,comp.unix.questions Subject: Re: Re^2: SED Question Keywords: sed, improvement, fix Message-ID: <1003@philmds.UUCP> Date: 13 Apr 89 22:00:08 GMT References: <2360001@hpcuhc.HP.COM> <38564@bbn.COM> <2292@solo11.cs.vu.nl> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 54 Xref: arizona comp.editors:893 comp.unix.questions:14149 In article <2292@solo11.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: [] |My first sed attempt can easily be fixed to handle partial matches at EOF |properly: | |sed -n ' | /^PROMPT>$/{ | $p | h | n | H | /^>$/{ | $b eof | n | /^<$/b | H | } | : eof | g | } | p |' I think you'll need a third attempt 8-). It still doesn't handle correct a series of lines like PROMPT> PROMPT> > < or one like PROMPT> > PROMPT> > < Alternative: sed -n ' : start $p $q N /^PROMPT>\n>\n<$/d /\n[^\n]*\n/{ P D } b start' Leo. Path: arizona!rupley From: rupley@arizona.edu (John Rupley) Newsgroups: comp.editors,comp.unix.questions Subject: Re: Re^2: SED Question Summary: need restart loop Keywords: sed, improvement, fix Message-ID: <10244@megaron.arizona.edu> Date: 14 Apr 89 02:14:07 GMT References: <2360001@hpcuhc.HP.COM> <38564@bbn.COM> <2292@solo11.cs.vu.nl> Organization: U of Arizona CS Dept, Tucson Lines: 67 Xref: arizona comp.editors:892 comp.unix.questions:14135 In article <2292@solo11.cs.vu.nl>, maart@cs.vu.nl (Maarten Litmaath) writes: > jgrace@bbn.com (Joe Grace) writes: [the problem is to delete all three-line sequences: PROMPT> > < ] > \... > \Yes, there is a way to get sed to do this, but you have to be > \wary of sed's shortcomings. > > [shell script workaround deleted] > > \If sed had a way of handling an EOF without quitting, the > \[workaround would be unnecessary] [...] > > My first sed attempt can easily be fixed to handle partial matches at EOF > properly: [sed script deleted] Neat script (of course), but it still fails with a partial sequence followed by a proper sequence, such as: PROMPT> > PROMPT> > < The ``restart'' loop below takes care of it: sed -n ' : restart /^PROMPT>$/{ h $p n /^>$/{ H ${x;p;} n /^<$/d } x p x b restart } p ' BTW -- the following one line Lex source does it all: %% PROMPT>\n>\n<\n ; and its hard to get the logic wrong (:-)! John Rupley rupley!local@megaron.arizona.edu From uucp Sat Apr 15 03:59 MST 1989 >From rupley Sat Apr 15 02:59:55 1989 remote from arizona Date: Sat, 15 Apr 89 02:59:55 MST From: "John Rupley" Message-Id: <8904150959.AA05764@megaron.arizona.edu> Received: by megaron.arizona.edu (5.59-1.7/15) id AA05764; Sat, 15 Apr 89 02:59:55 MST To: bellcore!texbell!sw1e!uucibg Subject: Re: SED question Cc: rupley!local Status: RO > I think I may have missed a posting or two on this topic. Could someone > please tell me why the following does not handle the problem: > > cat myfile | sed -e '/^PROMPT>$/,/^<$/d' The original posting is the first of the references listed in your posting. The obvious solution above wouldn't handle: PROMPT> one or more lines of stuff PROMPT> > < where only the three-line sequence should be deleted. Regardless of what the original poster wanted, the responders have amused themselves (myself included) by looking for fairly rigorous sed solutions. Note that sed cannot beat Lex's one line solution: %% ^PROMPT>\n>\n<\n ; John Rupley rupley!local@megaron.arizona.edu From local Mon Apr 17 21:33 MST 1989 To: arizona!bellcore!texbell!sw1e!uucibg Subject: SED amusement Cc: local Status: RO > > Note that sed cannot beat Lex's one line solution: > > > > %% > > ^PROMPT>\n>\n<\n ; > I wonder how large a scanner that would create? :-) Ah, but we should compare with the sed binary: Script started Mon Apr 17 21:14:16 1989 $ rup-local:/usr/local/unix/test/SED> cat jar.l %% ^PROMPT>\n>\n<\n ; $ rup-local:/usr/local/unix/test/SED> lex jar.l; cc lex.yy.c -ll;strip a.out $ rup-local:/usr/local/unix/test/SED> file a.out /bin/sed a.out: iAPX286 COFF executable small model /bin/sed: iAPX286 COFF executable small model $ rup-local:/usr/local/unix/test/SED> ls -l a.out /bin/sed -rwxrwxr-x 1 bin bin 20840 Oct 26 1985 /bin/sed -rwxrwxr-x 1 local sys 10940 Apr 17 21:16 a.out $ rup-local:/usr/local/unix/test/SED> Script done Mon Apr 17 21:17:47 1989 So, the answer is, "half the size" :-) :-). Regards, John Rupley rupley!local@megaron.arizona.edu >From mailrus!citi!bellcore!sw1e!uucibg@handies.ucar.edu Mon Apr 17 10:32:47 1989 Received: from noao.arizona.edu by megaron.arizona.edu (5.59-1.7/15) via SMTP id AA19530; Mon, 17 Apr 89 10:32:36 MST Received: from handies.ucar.edu by noao.edu via SMTP (5.61/SAG.G21) id AA02548; Mon, 17 Apr 89 10:31:06 -0700; for rupley@arizona.edu Received: by ncar.UCAR.EDU (5.58/1.00.UUCP-MOD.8-11-85) id AA08786; Mon, 17 Apr 89 11:32:41 MDT Received: by mailrus.cc.umich.edu (5.59/1.0) id AA12235; Mon, 17 Apr 89 08:20:03 EDT Received: by bellcore.bellcore.com (3.2/smail2.5/07-29-87) id AA26452; Mon, 17 Apr 89 08:18:14 EDT From: mailrus!sw1e!uucibg@handies.ucar.edu Received: by sw1e (5.54/1.14) id AA08358; Mon, 17 Apr 89 08:14:54 CDT Message-Id: <8904171314.AA08358@sw1e> Subject: Re: SED question To: uunet.uu.net!arizona!rupley%bellcore.UUCP@noao.edu (John Rupley) Date: Mon, 17 Apr 89 7:14:45 CST In-Reply-To: <8904150959.AA05764@megaron.arizona.edu>; from "John Rupley" at Apr 15, 89 2:59 am X-Mailer: Elm [version 2.1 beta-test PL11] Status: R > The obvious solution above wouldn't handle: > > PROMPT> > one or more lines of stuff > PROMPT> > > > < > > where only the three-line sequence should be deleted. Ahhh, I see. Thanks. I missed the issue of multiple occurances of "PROMPT>" before a matching "<". > > Regardless of what the original poster wanted, the responders have > amused themselves (myself included) by looking for fairly rigorous sed > solutions. :-) > Note that sed cannot beat Lex's one line solution: > > %% > ^PROMPT>\n>\n<\n ; I wonder how large a scanner that would create? :-) > John Rupley > rupley!local@megaron.arizona.edu Thanks, Brian R. Gilstrap Southwestern Bell Telephone One Bell Center Rm 17-G-4 ...!ames!killer!texbell!sw1e!uucibg St. Louis, MO 63101 ...!bellcore!texbell!sw1e!uucibg (314) 235-3929 #include Path: arizona!noao!ncar!unmvax!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!oliveb!sun!twinpeaks!jackh From: jackh%twinpeaks@Sun.COM (John Hevelin) Newsgroups: comp.editors Subject: Re: SED Question Message-ID: <99289@sun.Eng.Sun.COM> Date: 17 Apr 89 06:38:55 GMT Sender: news@sun.Eng.Sun.COM Reply-To: jackh@sun.UUCP (John Hevelin) Organization: Sun Microsystems, Mountain View Lines: 28 This works for me. Put the following in a script and call with "sed -f script file" /PROMPT>/ { N /PROMPT>\n[^>]/ { P D p b } /PROMPT>\n>/ { N /PROMPT>\n>\n[^<]/ { P D P D p b } /PROMPT>\n>\n Date: 18 Apr 89 00:44:04 GMT Sender: usenet@agate.BERKELEY.EDU Reply-To: merlin@violet.berkeley.edu () Organization: University of California, Berkeley Lines: 20 I think this does it (script run with "-f"): /PROMPT>/ { $b eof N $b eof N /PROMPT>\n>\n Date: 18 Apr 89 06:23:11 GMT References: <23224@agate.BERKELEY.EDU> Organization: U of Arizona CS Dept, Tucson Lines: 44 In article <23224@agate.BERKELEY.EDU>, merlin@violet.berkeley.edu writes: > I think this does it (script run with "-f"): > > /PROMPT>/ { > $b eof > N > $b eof > N > /PROMPT>\n>\n d > b > } > p > d > } > b > : eof > p > d > q No cigar - try: xxxPROMPT> > < PROMPT> > PROMPT> > < The script deletes what it shouldn't and doesn't what it should. At least three previous postings give apparently correct solutions. John Rupley rupley!local@megaron.arizona.edu Path: arizona!rupley From: rupley@arizona.edu (John Rupley) Newsgroups: comp.editors Subject: Re: SED Question Summary: buggy? Message-ID: <10336@megaron.arizona.edu> Date: 18 Apr 89 06:36:22 GMT References: <99289@sun.Eng.Sun.COM> Organization: U of Arizona CS Dept, Tucson Lines: 30 In article <99289@sun.Eng.Sun.COM>, jackh@sun.UUCP (John Hevelin) writes: > This works for me. Put the following in a script > and call with "sed -f script file" [sed script deleted] Seems like a buggy script -- for starters try it on: xxxPROMPT> > < PROMPT> > PROMPT> > < testing22 PROMPT> > Several previous postings handle such oddities, as does the Lex one-liner: %% ^PROMPT>\n>\n<\n ; John Rupley rupley!local@megaron.arizona.edu From uucp Tue Apr 18 09:59 MST 1989 >From uucibg@sw1e.swbt.com Tue Apr 18 06:16:57 1989 remote from arizona Received: from noao.arizona.edu by megaron.arizona.edu (5.59-1.7/15) via SMTP id AA20898; Tue, 18 Apr 89 06:16:57 MST Received: from handies.ucar.edu by noao.edu via SMTP (5.61/SAG.G21) id AA17287; Tue, 18 Apr 89 06:15:31 -0700; for rupley!local@arizona.edu From: arizona!uucibg@sw1e.swbt.com Received: by ncar.UCAR.EDU (5.58/1.00.UUCP-MOD.8-11-85) id AA00419; Tue, 18 Apr 89 07:17:10 MDT Received: from bellcore.UUCP by rutgers.edu (5.59/SMI4.0/RU1.1/3.04) with UUCP id AA12423; Tue, 18 Apr 89 08:44:01 EDT Received: by bellcore.bellcore.com (3.2/smail2.5/07-29-87) id AA21302; Tue, 18 Apr 89 08:31:03 EDT Received: by sw1e (5.54/1.14) id AA13003; Tue, 18 Apr 89 08:28:58 CDT Message-Id: <8904181328.AA13003@sw1e> Subject: Re: SED amusement To: noao!arizona!rupley!local%ncar.UUCP@noao.edu Date: Tue, 18 Apr 89 7:28:54 CST In-Reply-To: <8904180437.AA03056@megaron.arizona.edu>; from "rupley!local" at Apr 17, 89 9:37 pm X-Mailer: Elm [version 2.1 beta-test PL11] Status: RO > Ah, but we should compare with the sed binary: > -rwxrwxr-x 1 bin bin 20840 Oct 26 1985 /bin/sed > -rwxrwxr-x 1 local sys 10940 Apr 17 21:16 a.out > $ rup-local:/usr/local/unix/test/SED> > > So, the answer is, "half the size" :-) :-). Until you need a second quick-and-dirty utility :-) :-) :) :) :) (oh no! they're gremlinizing!)... > Regards, > John Rupley > rupley!local@megaron.arizona.edu From local Tue Apr 18 21:53 MST 1989 To: arizona!bellcore!texbell!sw1e!uucibg Subject: Re: ;-)....gremlins! Cc: local Status: RO > Until you need a second quick-and-dirty utility :-) :-) :) :) :) (oh no! they're > gremlinizing!)... But you left out the most important lines of the script in the last email: Script started Mon Apr 17 21:14:16 1989 ... ^^^^^^^ $ rup-local:/usr/local/unix/test/SED> lex jar.l; cc lex.yy.c -ll;strip a.out ... Script done Mon Apr 17 21:17:47 1989 ^^^^^^^^ Clearly, it is easier, and faster, to write _and compile_ a quick and dirty Lex one-liner than to get the logic right on a sed script for a multi-line match (even Maarten Litmaath got it wrong the first try, for this problem). (:-?....I agree, no gremlins) Truly, I use Lex for certain pattern-matching problems, just because it _is_ so easy. I use sed and awk more, but not if there is a straightforward Lex solution, which is likely if the problem is a multiline match. Sed and awk are line based, Lex is character-stream based. To each its own. Cheers, John Rupley Brian R. Gilstrap ...!ames!killer!texbell!sw1e!uucibg ...!bellcore!texbell!sw1e!uucibg (314) 235-3929 From uucp Wed Apr 19 09:57 MST 1989 >From uucibg@sw1e.swbt.com Wed Apr 19 05:46:42 1989 remote from arizona Received: from noao.arizona.edu by megaron.arizona.edu (5.59-1.7/15) via SMTP id AA29370; Wed, 19 Apr 89 05:46:42 MST Received: from handies.ucar.edu by noao.edu via SMTP (5.61/SAG.G21) id AA03803; Wed, 19 Apr 89 05:45:35 -0700; for rupley!local@arizona.edu From: arizona!uucibg@sw1e.swbt.com Received: by ncar.UCAR.EDU (5.58/1.00.UUCP-MOD.8-11-85) id AA02682; Wed, 19 Apr 89 06:47:11 MDT Received: from bellcore.UUCP by rutgers.edu (5.59/SMI4.0/RU1.1/3.04) with UUCP id AA16423; Wed, 19 Apr 89 08:40:28 EDT Received: by bellcore.bellcore.com (3.2/smail2.5/07-29-87) id AA14880; Wed, 19 Apr 89 08:20:50 EDT Received: by sw1e (5.54/1.14) id AA06634; Wed, 19 Apr 89 08:18:50 CDT Message-Id: <8904191318.AA06634@sw1e> Subject: Re: ;-)....gremlins! To: noao!arizona!rupley!local%ncar.UUCP@noao.edu Date: Wed, 19 Apr 89 7:18:38 CST In-Reply-To: <8904190457.AA11473@megaron.arizona.edu>; from "rupley!local" at Apr 18, 89 9:57 pm X-Mailer: Elm [version 2.1 beta-test PL11] Status: R > But you left out the most important lines of the script in the last email: > Script started Mon Apr 17 21:14:16 1989 > ... ^^^^^^^ > Script done Mon Apr 17 21:17:47 1989 > ^^^^^^^^ > Clearly, it is easier, and faster, to write _and compile_ a quick and dirty > Lex one-liner than to get the logic right on a sed script for a multi-line > match (even Maarten Litmaath got it wrong the first try, for this problem). > (:-?....I agree, no gremlins) > > Truly, I use Lex for certain pattern-matching problems, just because it > _is_ so easy. I use sed and awk more, but not if there is a > straightforward Lex solution, which is likely if the problem is a > multiline match. Sed and awk are line based, Lex is character-stream > based. To each its own. Good point. Especially since time is the thing I have the least of (in fact, it seems to be in inverse to the number of ideas I have for some reason... :-) > Cheers, > John Rupley Live long and prosper, Brian Gilstrap