home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.questions
- Subject: Re: File manipulation question
- Date: 7 Jan 1993 20:42:39 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 29
- Message-ID: <1ii4jvINNn85@early-bird.think.com>
- References: <1993Jan7.010450.28001@crpmks.uucp> <1ig9lnINN2ol@news.umbc.edu>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <1ig9lnINN2ol@news.umbc.edu> rouben@math9.math.umbc.edu (Rouben Rostamian) writes:
- >In article <1993Jan7.010450.28001@crpmks.uucp> marcs@crpmks.uucp (Marc Snyder) writes:
- >>AA1 01234 ....
- >> junk junk junk
- >> junk junk
- >>C1K 98765 ....
- >> junk junk
- >>COM 12121 ....
- >> junk
- >
- >[ and you like to keep the non-junk lines.]
- >
- >Use sed, as in:
-
- Or grep
-
- >sed -n '/^[A-Z][A-Z][0-9] [0-9][0-9][0-9][0-9][0-9]/p' infile > outfile
-
- That doesn't look right. The "C1K" line doesn't match that regular
- expression, for instance. Try:
-
- grep "^[A-Z0-9][A-Z0-9][A-Z0-9] [0-9][0-9][0-9][0-9][0-9]" infile > outfile
-
-
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-