I have this command which executes correctly if run directly on the terminal.
awk \'/word/ {print NR}\' file.txt | head -n 1
The purpose i
you could also pass the value as a variable to awk:
awk -v varA=$1 '{if(match($0,varA)>0){print NR;}}' $2 | head -n 1
Seems more cumbersome than the above, but illustrates passing vars.