Hi,
I have a text file as follows:
11:38:11.054 run1_rdseq avg_2-5 999988.0000 1024.0000
11:50:52.053 run3_rdrand 999988.0000 1135.0 128.0417
11:53:18.050 run4_wrrand avg_2-5 999988.0000 8180.5833
11:55:42.051 run4_wrrand avg_2-5 999988.0000 213.8333
11:55:06.053 run4_wrrand 999988.0000 9807 510.2083
I have a variable $run, that contains all the unique values of column 2. I need to print lines that match $run and the pattern 'avg'. So from the above text file I would want to print :
11:38:11.054 run1_rdseq avg_2-5 999988.0000 1024.0000
11:53:18.050 run4_wrrand avg_2-5 999988.0000 8180.5833
11:55:42.051 run4_wrrand avg_2-5 999988.0000 213.8333
If I do something like :
egrep -e '(run4_wrrand.*avg)' textfile.txt
, I get the right output. But if I do:
egrep -e '($run.*avg)' flatfile.html
I get no output. I know shell variables can not be used in this way, but how else can I achieve the above output?
Thanks
Anna