Here is another way to do it:
awk '$7~test {a++} END {print a+0}' test="3'UTR" file
You do not need the to set Field separator to tab, since tab and space is default.
Since awk
does not handle well single quote within the code, you can just define it outside the code. This way you do not need to remember the escape code to use it in the code. The +0
is used to print 0
if none is found, else it will just not print any thing.
You can also add the variable at the beginning.
awk -v test="3'UTR" '$7~test {a++} END {print a+0}' file