home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 16053 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.1 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!spool.mu.edu!hri.com!noc.near.net!nic.umass.edu!news.amherst.edu!twpierce
  2. From: twpierce@unix.amherst.edu (Tim Pierce)
  3. Newsgroups: comp.unix.questions
  4. Subject: beginners' awk questions
  5. Message-ID: <C1IzBD.488@unix.amherst.edu>
  6. Date: 27 Jan 93 18:28:24 GMT
  7. Distribution: ne
  8. Organization: Elitist Usenet Administrators, Stuff and Nonsense Division
  9. Lines: 19
  10.  
  11. I'm having some difficulty understanding some basic concepts in awk
  12. (Ultrix 4.2a, incidentally, with a DEC-supplied awk).  Suppose I have
  13. a file containing the single line "foo".  If I run it through this awk
  14. script,
  15.  
  16. { x = $0; print x[1] }
  17.  
  18. I expect to see either an "f" or possibly an "o" on output.  In fact,
  19. I get a blank line.  Why?  Changing the number within the subscript
  20. doesn't seem to help.  The man page is a little skimpy in describing
  21. the use of array subscripts.
  22.  
  23. (Distribution set to "ne" 'cause this is a dumb question and I see no
  24. reason to trouble more people than necessary with it.)
  25.  
  26. -- 
  27. ____ Tim Pierce                / 
  28. \  / twpierce@unix.amherst.edu /               Rocks say goodbye.
  29.  \/ (BITnet: TWPIERCE@AMHERST) / 
  30.