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

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!news.larc.nasa.gov!hal.larc.nasa.gov!alan
  3. From: alan@hal.larc.nasa.gov (alan dare)
  4. Subject: awk & echo under bourne
  5. Message-ID: <BuL1Dp.FAA@news.larc.nasa.gov>
  6. Originator: alan@hal.larc.nasa.gov
  7. Sender: news@news.larc.nasa.gov (USENET Network News)
  8. Organization: NASA Langley Research Center, Hampton, VA  USA
  9. Date: Mon, 14 Sep 1992 19:13:00 GMT
  10. Lines: 28
  11.  
  12.  
  13. I have a question on echo'ing and awk under the bourne shell.
  14.  
  15. First the awk question:
  16.  
  17. num=`grep NUM_OF_DISPLAYS displays.h| cut -d" " -f3`
  18. cat display_table.h |awk '$2 == $num {print $0}' >> temp
  19.  
  20. The variable num is set from looking into one file. The value of this
  21. variable resides in the second column on one line in a different file. I
  22. want to access this with awk, but I cant get awk to resolve the value of num.  
  23. Can awk access my shell variable?
  24.  
  25. The echo'ing question:
  26.  
  27. junk="start"
  28. echo "finish_$junk"    # Works
  29. echo "$junk_finish"    # Doesn't work
  30.  
  31. How do I get "start_finish" using only one echo (using two echos and "\c"
  32. has caused me some problems when its used to pipe into another command)?
  33.  
  34. Thanks for any and all help
  35. -- 
  36.  
  37. *********************************************************************
  38. Alan Dare                     |  Internet : alan@hal.larc.nasa.gov
  39. NASA Langley Research Center  | 
  40.