home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!axion!muppet!aero!bret
- From: bret@muppet.bt.co.uk (Bret Giddings)
- Newsgroups: comp.unix.shell
- Subject: Re: awk & echo under bourne
- Message-ID: <1992Sep15.103205.3446@muppet.bt.co.uk>
- Date: 15 Sep 92 10:32:05 GMT
- References: <BuL1Dp.FAA@news.larc.nasa.gov>
- Sender: news@muppet.bt.co.uk
- Reply-To: bret@muppet.bt.co.uk
- Organization: British Telecom Research Laboratories
- Lines: 33
-
-
- In article FAA@news.larc.nasa.gov, alan@hal.larc.nasa.gov (alan dare) writes:
- >
- >I have a question on echo'ing and awk under the bourne shell.
- >
- >First the awk question:
- >
- >num=`grep NUM_OF_DISPLAYS displays.h| cut -d" " -f3`
- >cat display_table.h |awk '$2 == $num {print $0}' >> temp
- >
- >Can awk access my shell variable?
-
- Using
-
- awk '$2 == NUM' NUM=$num display_table.h >> temp
-
- should do the trick (although I can't follow what you are trying to achieve :-[ )
-
- >
- >The echo'ing question:
- >
- >junk="start"
- >echo "finish_$junk" # Works
- >echo "$junk_finish" # Doesn't work
- >
- >How do I get "start_finish" using only one echo ...
-
- Use
-
- echo "${junk}_finish"
-
-
- Bret
-