Re: tell me how many specific words there are in the file?
- From: Måns Rullgård <mru@xxxxxxxxxxxxx>
- Date: Sat, 18 Mar 2006 15:50:24 +0000
Pascal Bourguignon <usenet@xxxxxxxxxxxxxxxxx> writes:
nitrogenix.fusion@xxxxxxxxx writes:
Hi,
I'm trying to get the user to enter a word, then the script should
search for how many of that word exists in the file. For example, I
want it to say, "There are 7 'and' words in the file", or "There are 5
'the' words in the file" etc...
I have the following which I used to find a specific character, but I
need to change this round to find words instead.
tr -dc $char < text | wc -c
Thanks for your help.
man grep
man 7 regex
Off the top of my head, I can't think of a grep command that will
count multiple matches on the same line. Am I overlooking something?
--
Måns Rullgård
mru@xxxxxxxxxxxxx
.
- Follow-Ups:
- Re: tell me how many specific words there are in the file?
- From: Logan Shaw
- Re: tell me how many specific words there are in the file?
- From: Pascal Bourguignon
- Re: tell me how many specific words there are in the file?
- References:
- tell me how many specific words there are in the file?
- From: nitrogenix . fusion
- Re: tell me how many specific words there are in the file?
- From: Pascal Bourguignon
- tell me how many specific words there are in the file?
- Prev by Date: Re: tell me how many specific words there are in the file?
- Next by Date: Re: Doing local RPC to cache network requests
- Previous by thread: Re: tell me how many specific words there are in the file?
- Next by thread: Re: tell me how many specific words there are in the file?
- Index(es):
Relevant Pages
|