I am wondering how to write the awk one liner :
cat <filename> | awk '$2 ~ /GRHL3/{print NR"\t"$0}'
which prints out the( or any) line that has the string "GRHL3" in it as well as its respective line number
the perl one liner for the same task I have so far is perl -ne 'print if /GRHL3/' <filename>
What do I have to add so that it will also print out the line number ... I feel like $. has to go somewhere? Thanks so much!! Also does someone know of a good web resource where you can look this sort of thing up (specifically about one liners).In reply to print if // line number? by ZWcarp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |