home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15860 < prev    next >
Encoding:
Text File  |  1993-01-23  |  1.0 KB  |  32 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!destroyer!ncar!netnews.whoi.edu!starmac5.mbl.edu!user
  3. From: dremsen@mbl.edu (David Remsen)
  4. Subject: Simple scripting questions
  5. Message-ID: <dremsen-220193161856@starmac5.mbl.edu>
  6. Followup-To: comp.unix.questions
  7. Sender: news@netnews.whoi.edu
  8. Organization: Marine Biological Laboratory
  9. Date: Fri, 22 Jan 93 21:25:13 GMT
  10. Lines: 20
  11.  
  12. I am trying to make a little shell script for a phone directory file.  I
  13. want
  14. to be able to ask the user for a string to search for and the field to
  15. search.
  16. The phone file is a comma delimited file so I want to use awk to
  17. search a particular field.
  18.  
  19. I assign the search input to a variable called find.  The problem is that
  20. awk doesnt seem to be able to deal with this variable.
  21.  
  22. awk -F: '$1 ~ /John/' phone.dat         - will work
  23. awk -F: '$1 ~ ${find}' phone.dat          - will not work
  24.  
  25. Can someone tell me why.  Ive tried all different permutations.  
  26.  
  27. Much appreciated,
  28.  
  29. David Remsen
  30. Marine Biological Laboratory
  31. dremsen@mbl.edu
  32.