home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / question / 15285 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  1.2 KB

  1. Path: sparky!uunet!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: File manipulation question
  5. Date: 7 Jan 1993 20:42:39 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 29
  8. Message-ID: <1ii4jvINNn85@early-bird.think.com>
  9. References: <1993Jan7.010450.28001@crpmks.uucp> <1ig9lnINN2ol@news.umbc.edu>
  10. NNTP-Posting-Host: telecaster.think.com
  11.  
  12. In article <1ig9lnINN2ol@news.umbc.edu> rouben@math9.math.umbc.edu (Rouben Rostamian) writes:
  13. >In article <1993Jan7.010450.28001@crpmks.uucp> marcs@crpmks.uucp (Marc Snyder) writes:
  14. >>AA1  01234 ....
  15. >>    junk     junk   junk
  16. >>        junk                    junk
  17. >>C1K  98765 ....
  18. >>                   junk          junk
  19. >>COM  12121 ....
  20. >> junk
  21. >
  22. >[ and you like to keep the non-junk lines.]
  23. >
  24. >Use sed, as in:
  25.  
  26. Or grep
  27.  
  28. >sed -n '/^[A-Z][A-Z][0-9]  [0-9][0-9][0-9][0-9][0-9]/p' infile > outfile
  29.  
  30. That doesn't look right.  The "C1K" line doesn't match that regular
  31. expression, for instance.  Try:
  32.  
  33. grep "^[A-Z0-9][A-Z0-9][A-Z0-9]  [0-9][0-9][0-9][0-9][0-9]" infile > outfile
  34.  
  35.  
  36. -- 
  37. Barry Margolin
  38. System Manager, Thinking Machines Corp.
  39.  
  40. barmar@think.com          {uunet,harvard}!think!barmar
  41.