[NTLUG:Discuss] Scripting help
Fred James
fredjame at fredjame.cnc.net
Tue Apr 28 11:34:03 CDT 2009
Dennis Myhand wrote:
> Fred James wrote:
>
>> Dennis Myhand
>> Is anywhere near that what you want (see below)?
>> Regards
>> Fred James
>>
>> $ cat fred
>> The quick brown fox jumped over the lazy dog
>> $ grep the fred | wc
>> 1 9 45
>> $ grep -i the fred | wc
>> 1 9 45
>> $
>>
>>
>
> Yeah, Fred, that works. What I finnaly did, just so they could see the
> redirect to another file as well was
>
> grep the fred | wc > thecount.txt
>
> That gets the numbers from wc out from under the line and redirects to
> another file. I want to give them a hypothetical example of grepping a
> pattern and saving the number of instances of the pattern to a file that
> can be reviewed later. These are mostly M$ children but even the one
> who runs Linux at home has never used a comamnd line before.
>
Dennis Myhand
Keep in mind that even with the i option (-i) this command line counts
the number of lines in which 'the' or 'The' occur, but not the number of
occurrences of the word.
Hope that helps
Regards
Fred James
More information about the Discuss
mailing list