home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!destroyer!ncar!netnews.whoi.edu!starmac5.mbl.edu!user
- From: dremsen@mbl.edu (David Remsen)
- Subject: Simple scripting questions
- Message-ID: <dremsen-220193161856@starmac5.mbl.edu>
- Followup-To: comp.unix.questions
- Sender: news@netnews.whoi.edu
- Organization: Marine Biological Laboratory
- Date: Fri, 22 Jan 93 21:25:13 GMT
- Lines: 20
-
- I am trying to make a little shell script for a phone directory file. I
- want
- to be able to ask the user for a string to search for and the field to
- search.
- The phone file is a comma delimited file so I want to use awk to
- search a particular field.
-
- I assign the search input to a variable called find. The problem is that
- awk doesnt seem to be able to deal with this variable.
-
- awk -F: '$1 ~ /John/' phone.dat - will work
- awk -F: '$1 ~ ${find}' phone.dat - will not work
-
- Can someone tell me why. Ive tried all different permutations.
-
- Much appreciated,
-
- David Remsen
- Marine Biological Laboratory
- dremsen@mbl.edu
-