Take jobs as they come -- and we'll never be under the heel of nobody ever again. No matter how long the arm of the Alliance might get, we'll just get ourselves a little further.

Mal ,'Out Of Gas'


Buffistechnology 2: You Made Her So She Growls?  

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!


DCJensen - Aug 04, 2005 8:14:31 am PDT #3871 of 10003
All is well that ends in pizza.

There's something bizarre happening on one of the Macs at work. The screen wiggles all around when you move the mouse. It's like pan and scan. Through an earthquake. Is it possessed? Can I make it stop?

Sounds like you've got the "Easy Access" turned on in OS9 [link] or it's equivelent in OSX [link] .


tommyrot - Aug 04, 2005 8:18:15 am PDT #3872 of 10003
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

Is there a way to use grep (or something similar) that will give me just a single count of all matches for multiple files? I can do this:

grep -cirh "panda" *

and it just returns the count of the matches, except it returns one number for each file. I want the total for all files.


Cass - Aug 04, 2005 8:23:00 am PDT #3873 of 10003
Bob's learned to live with tragedy, but he knows that this tragedy is one that won't ever leave him or get better.

Bless!

You know, zoom on a huge monitor doesn't zoom so much as shimmy shimmy.

All better now.


Tom Scola - Aug 04, 2005 8:43:41 am PDT #3874 of 10003
Remember that the frontier of the Rebellion is everywhere. And even the smallest act of insurrection pushes our lines forward.

perl -lne '$tot += grep /panda/i, split; END { print $tot }' *

Will count the number of occurrences of each word. Using grep will count the word only once, even if it occurs multiple times per line.


tommyrot - Aug 04, 2005 9:00:21 am PDT #3875 of 10003
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

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).


tommyrot - Aug 04, 2005 9:13:56 am PDT #3876 of 10003
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

Tom, is the search case-sensitive? Would you need to pass the -c parameter to grep for a non-case sensitive search?


Eddie - Aug 04, 2005 9:14:23 am PDT #3877 of 10003
Your tag here.

Actually, this might hurt your head less, tommyrot:

cat * | grep -cirh "panda"


Tom Scola - Aug 04, 2005 9:18:10 am PDT #3878 of 10003
Remember that the frontier of the Rebellion is everywhere. And even the smallest act of insurrection pushes our lines forward.

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 - Aug 04, 2005 9:19:09 am PDT #3879 of 10003
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

Tommyrot, the "/i" at the end of the "/panda/i" pattern makes it case insensitive.

Oh, OK, that makes sense.


Eddie - Aug 04, 2005 9:21:24 am PDT #3880 of 10003
Your tag here.

grep 2.5.1-26

Ok, I just copied tommyrot's switches, but this would be more correct:

cat * | grep -ci "panda"