Count Number of Occurrences of Characters in Line with AWK

Being able to count the number of occurrences of characters or words in text is a handy trick. Fortunately this is very easy to do in awk with the gsub() function. The syntax for using gsub() looks like this: gsub(regexp, replacement [, target]) gsub() will search target for substrings matching the provided regular expression and

read more