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