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

  1. Path: sparky!uunet!dtix!darwin.sura.net!haven.umd.edu!news.umbc.edu!math9.math.umbc.edu!rouben
  2. From: rouben@math9.math.umbc.edu (Rouben Rostamian)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: File manipulation question
  5. Message-ID: <1ig9lnINN2ol@news.umbc.edu>
  6. Date: 7 Jan 93 03:56:39 GMT
  7. References: <1993Jan7.010450.28001@crpmks.uucp>
  8. Organization: University of Maryland Baltimore Campus
  9. Lines: 23
  10. NNTP-Posting-Host: math9.math.umbc.edu
  11.  
  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. [ and you like to keep the non-junk lines.]
  25.  
  26. Use sed, as in:
  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. If the alphabetic characters are in mixed upper/lower case, replace
  31. each [A-Z] wiht [A-Za-z].
  32.  
  33. --
  34. Rouben Rostamian
  35.