in reply to Re: find a string and count of its occurence in a text file
in thread find a string and count of its occurence in a text file
For instance, this particular requirement might be easily met by awk
In fact, there's a general Linux recipe for just these things, generally introduced right around the time whatever book/tute/etc. decides to introduce pipes:
$ egrep ^abc <filename> | wc -l
Disclaim: This wouldn't work if OP had, say, wanted to find the total number of occurrences of a given string that happened to occur more than once per line in data; as it is, OP doesn't (or at least, data doesn't contain the sort of case that would prevent this working) :)
|
|---|