Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

get "bigger" value combined with a text

get "bigger" value combined with a text

get "bigger" value combined with a text


command produces output with many lines as on example:


No filesets which have fixes for IV00149 are currently installed.
    All filesets for IV00151 were found.
    All filesets for 71-01-031207_SP were found.
    All filesets for 71-00-041140_SP were found.
    All filesets for 71-01-021150_SP were found. 

I need to get the biggest "value" in column 4 for lines like matched in red.
here are commands which seems to do the job:


# nim -o fix_query 710spot_res|grep -E '( [0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]_.. )'|awk 'BEGIN {max = 0} {if ($4>max) max=$4} END {print max}'

# nim -o fix_query 710spot_res|awk 'NF==6&&$1=="All"&&$2=="filesets"&&$3=="for"&&$5=="were"&&$6=="found."&&$4~/^[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]_..$/{print $4}'|sort -n|tail -1

is there any easier way? e.g. single awk 'oneliner' without multiple piping?

RE: get "bigger" value combined with a text


Maybe something like this :

CODE --> command line

nim -o fix_query 710spot_res |
awk 'NF==6&&$1$2$3=="Allfilesetsfor"&&$5$6=="werefound."&&$4~/^[0-9]{2}-[0-9]{2}-[0-9]{6}_..$/&&max<$4{max=$4}END{print max}' 

Note that I added some further simplifications for readability, which may be an issue on your system :
  • Checking $1, $2 and $3 by their concatenate values may lead to erroneous matches. ( For example will also match "A llfilesetf or". Probably not a plausible menace.
  • )
  • Using {2}-like quantifiers required --re_interval switch in older gawk versions and may not work in other implementations.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close