home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / question / 15272 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.2 KB  |  38 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!widenius
  3. From: widenius@klaava.Helsinki.FI (Risto Widenius)
  4. Subject: Re: File manipulation question
  5. Message-ID: <1993Jan7.174148.23249@klaava.Helsinki.FI>
  6. Organization: University of Helsinki
  7. References: <1993Jan7.010450.28001@crpmks.uucp> <1ig9lnINN2ol@news.umbc.edu>
  8. Date: Thu, 7 Jan 1993 17:41:48 GMT
  9. Lines: 27
  10.  
  11. rouben@math9.math.umbc.edu (Rouben Rostamian) writes:
  12. >In article <1993Jan7.010450.28001@crpmks.uucp> marcs@crpmks.uucp (Marc Snyder) writes:
  13. >>    I have a quick question for everyone.  I have some files that are
  14. >>in the format:
  15. >>
  16. >>AA1  01234 ....
  17. >>    junk     junk   junk
  18. >>        junk                    junk
  19. >>C1K  98765 ....
  20. >>                   junk          junk
  21. >>COM  12121 ....
  22. >> junk
  23. >
  24. >Use sed, as in:
  25. >sed -n '/^[A-Z][A-Z][0-9]  [0-9][0-9][0-9][0-9][0-9]/p' infile > outfile
  26.  
  27. Fine, and what happens to the C1K and COM lines in the above example?
  28. Into the trashcan they go! You'd rather want to
  29.  
  30. sed '/^[A-Z0-9][A-Z0-9][A-Z0-9] / \!d' inf > outf
  31.  
  32. even though the \-escape does not work for other than c-shell
  33. derivatives. Probably the perl solution (which we will soon see) will be
  34. better.
  35.  
  36. --
  37. widenius@cc.helsinki.fi "But now there was worse." -Bernard Levin
  38.