Results 1 to 4 of 4

Thread: awk command

  1. #1
    Join Date
    Oct 2005
    Posts
    92

    Unanswered: awk command

    Hi all.,

    i am working on script.

    I have a file. i type ls -ltr and i get

    -rwxrwx--- 1 pavi C2052EX 15 Mar 21 09:50 START.TTN.20060321.095017.ctl_20060321095032

    ( pls note everything is in 1 line, here it came in 2 lines.)

    I have to use awk command and only get the MAR 21 to be displayed in the out.it is tab delimited.

    can anyone help me please how can i do it using awk

    thanks
    pavi

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    Try:
    Code:
    ls -ltr|nawk '/Mar 21/ {print $6,$7;}'

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Feb 2006
    Posts
    31
    ls -ltr | awk 'BEGIN{/Mar 21/} {print $6,$7;}'

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    But what is the use of displaying only the date?
    Maybe you want to display the file name:
    Code:
    ls -ltr|awk '/Mar 21/ {print $9;}'

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

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