home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!haven.umd.edu!news.umbc.edu!math9.math.umbc.edu!rouben
- From: rouben@math9.math.umbc.edu (Rouben Rostamian)
- Newsgroups: comp.unix.questions
- Subject: Re: File manipulation question
- Message-ID: <1ig9lnINN2ol@news.umbc.edu>
- Date: 7 Jan 93 03:56:39 GMT
- References: <1993Jan7.010450.28001@crpmks.uucp>
- Organization: University of Maryland Baltimore Campus
- Lines: 23
- NNTP-Posting-Host: math9.math.umbc.edu
-
- In article <1993Jan7.010450.28001@crpmks.uucp> marcs@crpmks.uucp (Marc Snyder) writes:
- > I have a quick question for everyone. I have some files that are
- >in the format:
- >
- >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:
-
- sed -n '/^[A-Z][A-Z][0-9] [0-9][0-9][0-9][0-9][0-9]/p' infile > outfile
-
- If the alphabetic characters are in mixed upper/lower case, replace
- each [A-Z] wiht [A-Za-z].
-
- --
- Rouben Rostamian
-