I have a problem of feeding input file to saved awk script.
I want to save awk scirpt to a file and feed the file name from command line but do not work.
test.awk
---------------------------------------------
awk "{$1~/query|seq/}{a[$1]=$2}{print a["query"]"\t"a["seq"]"\t"}'
-------------------------------------------------------
chmod +x test.awk
$ ./test.awk inputefile
It doesn't work!!
if I do the following it will work
--------------------------------------------------
awk "{$1~/query|seq/}{a[$1]=$2}{print a["query"]"\t"a["seq"]"\t"}'inputfile
$./test.awk
But I don't want to edit the file every time I change the inputfile name
Dereje
I want to save awk scirpt to a file and feed the file name from command line but do not work.
test.awk
---------------------------------------------
awk "{$1~/query|seq/}{a[$1]=$2}{print a["query"]"\t"a["seq"]"\t"}'
-------------------------------------------------------
chmod +x test.awk
$ ./test.awk inputefile
It doesn't work!!
if I do the following it will work
--------------------------------------------------
awk "{$1~/query|seq/}{a[$1]=$2}{print a["query"]"\t"a["seq"]"\t"}'inputfile
$./test.awk
But I don't want to edit the file every time I change the inputfile name
Dereje