home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3846 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.2 KB  |  38 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!news.uit.no!stud.cs.uit.no!ronnya
  3. From: ronnya@stud.cs.uit.no (Ronny Haavard Arild)
  4. Subject: Awk problem
  5. Sender: news@news.uit.no (USENET News System)
  6. Organization: University of Tromsoe, Norway
  7. Date: Tue, 8 Sep 1992 11:35:17 GMT
  8. Message-ID: <1992Sep8.113517.17401@news.uit.no>
  9. Lines: 27
  10.  
  11. When I write this line in my shell (zsh):
  12.  
  13. awk '/ .    [0-9.*]+ +[0-9]+ +[0-9.]+  */ {printf "%10s|%5s|%4s|%s\n", \ 
  14. substr($0,7,10), substr($0,20,5), substr($0,27,4), substr($0,33,120)}' \
  15. <oldfile> | tr "[A-Z]" "[a-z]" > <newfile>
  16.  
  17. from this line in <oldfile>:
  18.  
  19.       0000001231     212   8.1  African Queen, The
  20.  
  21. I get this line in <newfile>:
  22.  
  23. 0000001231|  212| 8.1|aGS═╟┴╤ q┌╔╔╤, tI╔
  24.  
  25. While what I want is this:
  26.  
  27. 0000001231|  212| 8.1|african queen, the
  28.  
  29. Could someone please help me out, as I'm stuck. From the little I know about
  30. awk this should work.
  31.  
  32. Ronny
  33. -- 
  34.    Ronny H. Arild    | ronnya@stud.cs.uit.no | "The knack of flying is learning
  35.     P.O.Box 5580     | University of Tromsoe | how to throw yourself at the
  36.  N-9022 Krokelvdalen | ****** NORWAY ******* | ground and miss."-Douglas Adams
  37. copy this line into your .signature to protect it against viruses! [version-9]
  38.