[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: find+grep [was: Re: Amaya W3C Web browser and sid]



On 7/29/10 4:57 AM, Andrei Popescu wrote:
On Jo, 29 iul 10, 09:50:32, Tzafrir Cohen wrote:

If you stop it with ctrl-C, both find and grep get interrupted and stop,
right?

Actually I don't know how shell pipes work here. Is the output of find
piped to grep only when find finishes or as soon as there is some
output?

Regards,
Andrei

As soon as there is an output (which is always immediately) so think of each iteration of find as being piped to grep, you don't lose *much* efficiency but you do lose *some*, efficiency is subjective here since it's CPU time you lose. So if you do a find on root "var and home" would an iteration (like normal), except instead of staying inside of find it's piped to grep for each iteration, this is where you lose *some* CPU time, but you gain a lot more power. You can exit out of the find using CTRL+C though as somebody did point out CTRL+C is the universal knock your shit off hot-key for terminals.

I opt to pipe to grep because I usually do a lot more complicated things with find and over time, I just kept using grep, it's a personal preference really. Just like using locate is far faster than using find and find -name is slower and so forth on down the line. I've never been a big fan of locate though because it can miss on some machines with horrible i/o.


Reply to: