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.

A Fisherman on the Back of a Whale

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.

An Antelope with its Horns Entangled in a Bush

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:

ℜ> grep -c Boniface access_log* access_log:0 access_log.i:3 access_log.ii:777 ℜ> _

Ctrl-D, Amen.

A Fisherman on the Back of a Whale, after 1277, Franco-Flemish
An Antelope with its Horns Entangled in a Bush, after 1277, Franco-Flemish
Digital images courtesy of the Getty’s Open Content Program

~ this page pub. 28 October 2013 ~
« previouse page: Wyld Kingdom: lions ~ Table of Contentes ~ next page: Sponsors »