Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2008
    Posts
    96

    Unanswered: OS Script problem

    Friends
    I m tryin to write a script to collect the logs from iqmsg file as the file is to large i hav to grep the log messages of particular time.
    The format of the messages in the file is as
    06/11 20:00:00......................
    i wrote the script as following


    dir1=/sybasedata/sybase
    iqmsg=`date +%m`/`date +%d`
    temp=`date +%H`
    echo $temp
    temp2=' '
    temp1='"'$iqmsg$temp2$temp'"'
    echo $temp1
    echo $iqmsg

    dir2=$dir1/mydb.iqmsg
    #echo $dir2
    grep $test1 $dir2 > /opt/sybase/SCRIPTS/logs/iqmsglog

    o/p of echo is "06/11 14"
    when i use
    $ grep "06/11 14" /sybasedata/sybasemydb.iqmsg >/opt/sybase/SCRIPTS/logs/iqmsglog

    it greps the required information into /opt/sybase/SCRIPTS/logs/iqmsglog

    but when i tried to do the same thing from inside the script it gives me the error:
    grep: 0652-033 Cannot open 20".


    can anybody help me in this i am using AIX OS.

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    change the bit that says
    Code:
    grep $test1 $dir2
    to
    Code:
    grep "$test1" $dir2

Posting Permissions

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