Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all, I am trying to do a for each script but cant seem to get it right, can someone point me in the correct direction? This is what i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2006
    Posts
    4

    Script Help


    Hi all,

    I am trying to do a for each script but cant seem to get it right, can someone point me in the correct direction?

    This is what i have so far.

    if

    grep UPDATED=Y *.lib

    then

    grep UPDATED=Y -B 8 *.lib | grep NAME= > newsigs`date '+%d%m%y'`
    cat newsigs`date '+%d%m%y'` | mail -s "NEW SIGS" XXXX@XXX.com
    rm -f newsigs`date '+%d%m%y'`

    else

    cat No_New_Sigs | mail -s "NO NEW SIGS" XXXX@XXX.com
    fi

    now what i want to achieve is after the 'then' i want a for each command that has the following commands in:

    grep UPDATED=Y -B 8 *.lib | grep NAME= > newsigs`date '+%d%m%y'`
    grep UPDATED=Y -B 8 *.lib | grep EVENTGROUP= > newsigs`date '+%d%m%y'`


    Any help is much appreciated


    Nick T

  2. #2
    Linux Newbie jpalfree's Avatar
    Join Date
    Jul 2005
    Location
    Montreal, CA
    Posts
    198
    I'm not sure what you are trying to do... and I assume you want a BASH script. I'd be glad to help but you need to explain, step by step, what you are trying to do.
    Avatar from xkcd.com, a hilarious computer related webcomic.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •