Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2005
    Posts
    4

    Unanswered: maximum number value row as output

    Hello all,

    I am not very much familiar in shell scripts but to some extent I can write.

    I have a final output of file and if the value Retur code is more than "0" the final out file should have that row.

    The actual file looks as follows:
    file1.temp
    Number RC
    TTT7670 0
    TTT8769 4
    TTT9987 7
    TTT1766 0
    TTT8888 0


    Now I need the file.output as only RC > 0 entries as follows:

    TTT8769 4
    TTT9987 7

    Please help, i have tried for loop and it reads every field and i am unable to pass the required entries. Please help.

    Thank you

  2. #2
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138
    Hi Steve,
    try this :

    cat file1.temp | awk ' BEGIN { FS=" " }
    {
    if ($2 > 0 )
    {
    print $0 > "file.output"
    }
    }'
    Greetings from germany
    Peter F.

  3. #3
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    awk '$2 > 0' file
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  4. #4
    Join Date
    Jan 2005
    Posts
    4

    maximum number value row as output

    Than kyou very much,

    I actually want to send a page with the out file if we have any RC > 0 entries if not i don't want to create the file also.

    Please help.

  5. #5
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138
    Quote Originally Posted by steve_johnson
    Than kyou very much,

    I actually want to send a page with the out file if we have any RC > 0 entries if not i don't want to create the file also.

    Please help.
    Please give an example. I don´t understand what you want.
    Greetings from germany
    Peter F.

Posting Permissions

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