geeksinthetown
Showing posts with label
Count the number of occurances of a pattern in a file using awk
.
Show all posts
Showing posts with label
Count the number of occurances of a pattern in a file using awk
.
Show all posts
Tuesday, April 10, 2012
Count the number of occurances of a pattern in a file using awk
awk '{ for (i=1;i<=NF;i++) if ( $i == "word" ) count++ } END{print count}' filename
This will print the count of the occurance of a pattern "word" in a file.
Older Posts
Home
Subscribe to:
Posts (Atom)