Re: help with grep looking for cats and dogs



Kevin Fleming wrote:


Thanks to everyone for their help on this. I'm stilll learning how scripts and the syntax works... Brian's suggestion: find /tmp -type f |xargs fgrep -l cat |xargs fgrep -l dog was the simplest for me to understand, even if it wasn't the most efficient. I promise to spend some time learning about shell scripts, and I appreciate the explanations with the examples.

Thanks again,
Kevin


<OPINION>

grep is fine for simple use; I use it almost every day.

The minute I find myself piping to awk or building a line with more than one pipe in it, I stop myself and ask "Wouldn't this be easier with Perl?"

And of course the answer always is "yes".

I don't mean to discourage anyone from learning awk or shell scripting in general - it's good to know this stuff. But when your goal is to get something done efficiently and quickly, Perl is often a much better choice.

If you already know a bit about awk and grep, Perl is easy to learn -
you don't have to be expert to get a lot of mileage out of your knowledge. Take a peek at http://aplawrence.com/Unixart/loveperl.html for a gentle introduction.


</OPINION>

--
Tony Lawrence
Unix/Linux/Mac OS X  resources: http://aplawrence.com
.



Relevant Pages

  • Re: help with grep looking for cats and dogs
    ... help with grep looking for cats and dogs ... I promise to spend some time learning about shell scripts, and I appreciate the explanations with the examples. ... The minute I find myself piping to awk or building a line with more than ... If you already know a bit about awk and grep, Perl is easy to learn - ...
    (comp.unix.sco.misc)
  • Re: [PATCH] Linux 2.6: shebang handling in fs/binfmt_script.c
    ... > don't split the optional shebang argument, ... > script files and their interpreters (shells, awk, perl, python, guile, ... This may be right for awk, although I still consider wrapper scripts to ... But your argument is not true for shells, perl, ...
    (Linux-Kernel)
  • Re: help with grep looking for cats and dogs
    ... I promise to spend some time learning about shell scripts, and I appreciate the explanations with the examples. ... The minute I find myself piping to awk or building a line with more than ... If you already know a bit about awk and grep, Perl is easy to learn - ...
    (comp.unix.sco.misc)
  • Re: Awk - pattern matching
    ... I have learned alot from your scripts. ... This is a very clever solution. ... It also doesn't work with BWK's AWK, the default AWK on FreeBSD and ... the last matching pattern is found on. ...
    (comp.lang.awk)
  • Re: [OT] Sed and Awk
    ... > The scripts are longer for sed, just as ASM source is longer than C source. ... Some things are admittedly much easier to do with sed than with awk, ... of different assembly languages before learning either of them. ... Rather it seems people who use perl disdain both sed and awk, ...
    (comp.unix.shell)