As we rely upon shepherds to find lambs within our greenswards, so we rely upon ‘grep’ to find words within our Files. Grep, whose name comes to us from one of the many Saxon words for ‘grab’, has no equal when one needs lay hand upon a string from within the many that o’erflow from our Files.
Mayhap you know already the Option for grep ‘-i’, dash eye. This option commandeth grep to ignore the case of the word being searched for; to be ‘case insensityve’. To pay as little mind to the size of the letters being sought as Cook pays us when we beg for a breakfast other than gruel.
But ofttimes when seeking a string regardless of Case, and indeed at other times as well, the quantity of matches may number as the grains of Wheat in the field, or the number of Angels upon the head of a pin. And sometimes we care not for the literal Line that contains yon match, but only whether such Lines exist. Or by turn thou may wonder how many matches there may be.
This is where we come to the Option ‘-c’, dash see. This option calls upon grep to only count the number of our quarry. It will report to you that there be zero, or one, or two, or a thousand Lines with the string ye seek contained. Of course these options herein writ may be combined: ‘-ic’, dash eye see, which counts the string for which you hunt, regardless of case.
Once again it is logges on which we oft ply this option, for it is especial useful with multiple Files. It divulges us the File Name and the match count for each. Id est: