Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    92

    Unanswered: grep space problem

    Hello.,

    1 gggggg C2052EX 15 Mar 31 13:03
    1 rrrrrr C2052EX 15 Apr 3 12:00

    todaydat=`date | awk -F" " '{print $2" "$3 }'` (# the output must be like Apr 3, or March 31 or Oct 8 etc)

    find DIR_PATH/START.*.*.*.ctl* -exec ls -ltr {} \; -mmin +200 | grep "$todaydat" | awk -F" " {'print $9'}

    I have a peculiar spacing problem.when i used the above find comman on march 31st it worked fine. but on april 3 it did not work.

    the reason: Mar 31
    Apr 3
    the space between r and 3 in Marc 31 is one
    but the space between r and 3 in Apr 3 is two.

    so the same find command which worked on march 31st is not working on april 3rd.

    can anyone please give me a suggestion to solve this.

    thanks
    pavi

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    delete the space with sed
    Code:
    todaydat=`date '+%b %e' | sed 's/  / /g'`

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    I think I misread what you want. I think you want the extra space i.e.
    Code:
    todaydat=`date '+%b %e'`

  4. #4
    Join Date
    Oct 2005
    Posts
    92

    grep

    thanks a lot guys..
    it is working fine for me now.

    thanks once again
    pavi

Posting Permissions

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