I want to count number of times the value "gafgyt" is coming in my input file. My input file input.txt is :
"result": "Gen:Variant.New.Linux.Gafgyt.5"
"result": null
"result": "ELF:Gafgyt-DZ"
"result": null
"result": "Gen:Variant.Linux.Gafgyt.5"
and my code is :
awk -F ":" 'BEGIN { i=1 } IGNORECASE = 1 { if ($2 ~ /gafgyt/) { i++;print $2} else {} }' input.txt
But value of counter i is not getting incremented.
Aucun commentaire:
Enregistrer un commentaire