2008/11/21 Jobst Schmalenbach <[EMAIL PROTECTED]>: > > Hi. > > I beg to differ. > > 1: its quicker to type "fstr HTML '*.php'"
It's shorter to define: function fstr() { grep -r --colour=always --include="${2:-*}" $1 . | less -R; } If you insist on using fstr :) > > 2: less (and more) kill the highlighting done by grep I said, Jeff repeated and I'll repeat it again - "less -R" doesn't kill colors. > > 3: grep has to (internally) call the other processes to to the same I am > already doing with pipes Nope. Grep doesn't have to call 4 external programs (find, xrgs, grep and sed) to find files, open them, search for a string and color-hilight it. I didn't even count the couple of calls to "tput". Do a little experiment - time(1) the two options (run each at least twice so the other option won't benefit from caching offered by the first run). > > 4: (overly pedantic): can do more with find grep can ever do and I can > decide the order of my pipes and WHAT I want to do. But not with fstr() as you defined it above. If you insist on using find(1)'s file picking power then even the following looks a bit more appealing to me: function fstr() { find "${2}" -print0 | grep --colour=always $1 | less -R } (BTW - I already benefited from this thread - I just noticed grep's --exclude-dir which will allow me to exclude .svn directories even better - thanks!). Plus if you get used to using "grep -r" etc then it's more readily available on "foreign territory" (e.g. one of the dozens of servers we manage on which I didn't get around to install all my favorite aliases). Cheers, --Amos -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html