bondtrails
Technical User
Hi everyone,
if the file inFile.txt containts:
0001 GOODBYE a001.txt
0002 HELLO b001.txt
0003 STAY c001.txt
and when I type this on the command line,
grep 'HELLO' inFile.txt | awk '{ print $3 }'
the output is a001.txt
but how can I do this in a script?
I have tried:
#!/bin/sh
A="grep 'HELLO' inFile.txt | awk '{ print \$3 }'"
B="$A"
this errors out. I want to be able to capture the value a001.txt into the variable B
thanks!!
--Bondster!!
if the file inFile.txt containts:
0001 GOODBYE a001.txt
0002 HELLO b001.txt
0003 STAY c001.txt
and when I type this on the command line,
grep 'HELLO' inFile.txt | awk '{ print $3 }'
the output is a001.txt
but how can I do this in a script?
I have tried:
#!/bin/sh
A="grep 'HELLO' inFile.txt | awk '{ print \$3 }'"
B="$A"
this errors out. I want to be able to capture the value a001.txt into the variable B
thanks!!
--Bondster!!