Thanks!
I'll have to stare at that later to figure out how it works (haven't done any perl coding in a few years).
Got a question about technology? Ask it here. Discussion of hardware, software, TiVos, multi-region DVDs, Windows, Macs, LINUX, hand-helds, iPods, anything tech related. Better than any helpdesk!
Thanks!
I'll have to stare at that later to figure out how it works (haven't done any perl coding in a few years).
Tom, is the search case-sensitive? Would you need to pass the -c parameter to grep for a non-case sensitive search?
Actually, this might hurt your head less, tommyrot:
cat * | grep -cirh "panda"
What version of grep are you using, Eddie? In GNU grep, those options don't do what you think they do.
Tommyrot, the "/i" at the end of the "/panda/i" pattern makes it case insensitive.
Tommyrot, the "/i" at the end of the "/panda/i" pattern makes it case insensitive.
Oh, OK, that makes sense.
grep 2.5.1-26
Ok, I just copied tommyrot's switches, but this would be more correct:
cat * | grep -ci "panda"
As I said before, that will only print out the number of lines that match, not the number of words.
D'oh! Yeah, you're right.
Here:
cat * | grep -i "panda" | wc -w
or to go within directories:
grep -ir "panda" * | wc -w
That will count the number of words in lines that have "panda" in them, including all the words that aren't "panda".
Ok, you win... I need more sleep.