Re: Help with grep

From: Alan Connor (xxxxxx_at_xxxx.xxx)
Date: 08/29/03

  • Next message: Kurtis D. Rader: "Re: understanding ps -ef output"
    Date: Fri, 29 Aug 2003 03:53:08 GMT
    
    

    On 28 Aug 2003 18:10:16 -0700, David <davidol@hushmail.com> wrote:
    >
    >
    > Hi there,
    >
    > I want to recursively search directories for scripts that don't use
    > our environment file foo_env.sh -- if the script uses foo_env.sh, it's
    > sourced once in the file.
    >
    > This command doesn't give me what I want, it instead returns any
    > scripts that don't refer to foo_env.sh on every line!
    >
    > find . | xargs grep -v 'foo_env.sh' | cut -f1 -d: | uniq
    >
    > Could someone suggest a command that will work...
    >
    > Thanks,
    >
    > David

    This should, David:

    #!/bin/sh

    for file in `find . -type f` ; do

    if ! grep 'string' $file &> /dev/null ; then
    echo "$file" >> ~/listfile
    else continue
    fi
    done

    $EDITOR ~/listfile

    exit 0

    Alan C

    -- 
      
       take control of your mailbox ----- elrav1 ----- http://tinyurl.com/l55a
    

  • Next message: Kurtis D. Rader: "Re: understanding ps -ef output"

    Relevant Pages

    • Re: Help with grep
      ... David wrote: ... >I want to recursively search directories for scripts that don't use ... >Could someone suggest a command that will work... ...
      (comp.unix.shell)
    • Re: Help with grep
      ... > I want to recursively search directories for scripts that don't use ... > scripts that don't refer to foo_env.sh on every line! ... > Could someone suggest a command that will work... ...
      (comp.unix.shell)
    • Help with grep
      ... I want to recursively search directories for scripts that don't use ... our environment file foo_env.sh -- if the script uses foo_env.sh, ... Could someone suggest a command that will work... ...
      (comp.unix.shell)
    • Re: vi horizontal split screen
      ... efficient at processing scripts, and one way to do that was substitute ... Microsoft's work for OLE in Windows 1x through 3x. ... As more and more users come to Linux who have no desire for command line ... effectively a programming environment. ...
      (comp.editors)
    • Re: Cron to email notification of ftp file upload?
      ... or traceroute and getting "command not found" messages and then trying to ... >use sudo command when you need to make root privileged changes, ie, ... [ohmster@ohmster scripts]$ sudo crontab -l ... $ cat ftpwatch ...
      (alt.os.linux)