Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] GREP basics
- Date: Thu, 30 Jan 2003 09:57:51 -0500
- From: Josh Glover <jmglov@example.com>
- Subject: Re: [tlug] GREP basics
- References: <20030130.234546.74755592.acmuller@example.com>
- User-agent: Mutt/1.4i
Quoth Charles Muller (Thu 2003-01-30 11:45:46PM +0900): > > I have a directory that contains 82 files. I want to get a count of the > number of occurrences of the word "<hdwd>" in all 82 files. [...] > I have looked at all of the options listed in _man grep_, but I don't see > anything for listing just the total number of hits at the end. I would > think that this must be a rather elementary GREP function, but I don't see > any explanation for it. Can anyone give me a clue? I can't tell you the grep option, but this will work: grep -ci "Captain's Log" * | perl -e \ '$num=0; while(<>){ my @example.com = split(/\:/); $num += $foo[1]; } print "$num\n";' You could accomplish the same thing with awk in a shell script. -- Josh Glover <jmglov@example.com> Associate Systems Administrator INCOGEN, Inc. http://www.incogen.com/ GPG keyID 0x62386967 (7479 1A7A 46E6 041D 67AE 2546 A867 DBB1 6238 6967) gpg --keyserver pgp.mit.edu --recv-keys 62386967Attachment: pgp00094.pgp
Description: PGP signature
- References:
- [tlug] GREP basics
- From: Charles Muller
Home | Main Index | Thread Index
- Prev by Date: [tlug] GREP basics
- Next by Date: Re: [tlug] GREP basics
- Previous by thread: [tlug] GREP basics
- Next by thread: Re: [tlug] GREP basics
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links