I gavehave this file
a deiauk Biking US 200 G b kespaul 202 A c deiauk NY 222 5 Z And I want to machmatch the exact string 200 using awk. soSo my resulresult should be
a deiauk Biking US 200 G Here's my code
awk -F ' ' '{if($(NF-1) ~ /200/){a[$1]++}}END{for (var in a){print a[var] " " var " " $(NF-1)}}' file.txt But after that I got all lines.