file
11 2
12 6
13 7
114 6
011 7
if I'm searching for 11, output needed is
output:
11 2
011 7
Code: awk '$1 ~ /^11$/' file
I used the above to match exact, but it avoiding "011 7" line too, how to resolve this?
file
11 2
12 6
13 7
114 6
011 7
if I'm searching for 11, output needed is
output:
11 2
011 7
Code: awk '$1 ~ /^11$/' file
I used the above to match exact, but it avoiding "011 7" line too, how to resolve this?
Try
$ awk '$1+0 == search' search=11 file
11 2
011 7
Thanks, as you already explained the numeric and text concept with $+0, i tried like
awk '$+0 ~ /11/' file
and it dint work.
Now it working with == and variable, thanks...
$ awk '$1+0 ~ /^11$/' file
11 2
011 7
thanks, missing field..
Or
awk '$1==11' file
Small modification to your code in post#1 will make it work:
awk '$1 ~ /^0*11$/' file