home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3959 < prev    next >
Encoding:
Internet Message Format  |  1992-09-15  |  1.0 KB

  1. Path: sparky!uunet!mcsun!uknet!axion!muppet!aero!bret
  2. From: bret@muppet.bt.co.uk (Bret Giddings)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: awk & echo under bourne
  5. Message-ID: <1992Sep15.103205.3446@muppet.bt.co.uk>
  6. Date: 15 Sep 92 10:32:05 GMT
  7. References: <BuL1Dp.FAA@news.larc.nasa.gov>
  8. Sender: news@muppet.bt.co.uk
  9. Reply-To: bret@muppet.bt.co.uk
  10. Organization: British Telecom Research Laboratories
  11. Lines: 33
  12.  
  13.  
  14. In article FAA@news.larc.nasa.gov, alan@hal.larc.nasa.gov (alan dare) writes:
  15. >
  16. >I have a question on echo'ing and awk under the bourne shell.
  17. >
  18. >First the awk question:
  19. >
  20. >num=`grep NUM_OF_DISPLAYS displays.h| cut -d" " -f3`
  21. >cat display_table.h |awk '$2 == $num {print $0}' >> temp
  22. >
  23. >Can awk access my shell variable?
  24.  
  25. Using 
  26.  
  27. awk '$2 == NUM' NUM=$num display_table.h >> temp
  28.  
  29. should do the trick (although I can't follow what you are trying to achieve :-[ )
  30.  
  31. >
  32. >The echo'ing question:
  33. >
  34. >junk="start"
  35. >echo "finish_$junk"    # Works
  36. >echo "$junk_finish"    # Doesn't work
  37. >
  38. >How do I get "start_finish" using only one echo  ...
  39.  
  40. Use
  41.  
  42. echo "${junk}_finish"
  43.  
  44.  
  45. Bret
  46.