home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!widenius
- From: widenius@klaava.Helsinki.FI (Risto Widenius)
- Subject: Re: File manipulation question
- Message-ID: <1993Jan7.174148.23249@klaava.Helsinki.FI>
- Organization: University of Helsinki
- References: <1993Jan7.010450.28001@crpmks.uucp> <1ig9lnINN2ol@news.umbc.edu>
- Date: Thu, 7 Jan 1993 17:41:48 GMT
- Lines: 27
-
- rouben@math9.math.umbc.edu (Rouben Rostamian) writes:
- >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
- >
- >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
-
- Fine, and what happens to the C1K and COM lines in the above example?
- Into the trashcan they go! You'd rather want to
-
- sed '/^[A-Z0-9][A-Z0-9][A-Z0-9] / \!d' inf > outf
-
- even though the \-escape does not work for other than c-shell
- derivatives. Probably the perl solution (which we will soon see) will be
- better.
-
- --
- widenius@cc.helsinki.fi "But now there was worse." -Bernard Levin
-