home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!wupost!cs.utexas.edu!uwm.edu!ogicse!reed!romulus!merlyn
- From: merlyn@romulus.reed.edu (Randal L. Schwartz)
- Newsgroups: comp.unix.questions
- Subject: Re: AWK Iteration
- Message-ID: <MERLYN.92Aug29134120@romulus.reed.edu>
- Date: 29 Aug 92 20:41:24 GMT
- Article-I.D.: romulus.MERLYN.92Aug29134120
- References: <1992Aug28.183452.2245@midway.uchicago.edu>
- Sender: news@reed.edu (USENET News System)
- Organization: Reed College
- Lines: 27
- In-Reply-To: a-douglas@uchicago.edu's message of 28 Aug 92 18:34:52 GMT
-
- In article <1992Aug28.183452.2245@midway.uchicago.edu> a-douglas@uchicago.edu (Allen Douglas) writes:
- The logic is:
-
- Read in to beginning of first break point (case)-(this output will be discarded)
- Start reading the first case until beginning of next case and send text of case to temporary file .
- Process commands on temp file, output to results file(s.)
- Read in text of the next case, until the begining the next+1 case. (replacing the previous output)
-
- The cases (as in legal case) have delimeters of "of 38 CASES"
-
-
- In Perl, this would be:
-
- perl -pe 'open(STDOUT,"|some_command >result.".++$i),$_="",next if /of 38 CASES/' \
- <yoursourcefile >headertext
-
- "headertext" will contain the stuff before the first "of 38 CASES".
- "result.1","result.2"... will contain the results of running "some_command"
- over each segment between "of 38 CASES".
-
- Too easy with Perl.
-
- print "Just another Perl hacker,"
- --
- Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
- merlyn@reed.edu (guest account) merlyn@ora.com (better for permanent record)
- cute quote: "Welcome to Portland, Oregon -- home of the California Raisins!"
-