in reply to Re: grep command
in thread grep command
That's the simple modification I told about:
$ perl -n -e '$count++ while /\bhello\b/g; END { print $count }' text. +out
And to answer kyle at Re^2: grep command, my interpretation was that he was concerned about how many times the word happened with no concern for which particular lines. But then he tells about grepping — so if the issue is finding the lines and then telling how many times it appeared in total, this one may work:
$ perl -n -e 'print, $count++ while /\bhello\b/g; END { print $count } +' text.out
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: grep command
by ww (Archbishop) on Jan 18, 2007 at 16:47 UTC | |
|
Re^3: grep command
by Tux (Canon) on Jan 18, 2007 at 14:12 UTC | |
by blazar (Canon) on Jan 19, 2007 at 09:20 UTC |