i have the following line:
</PRE></TD></TR><TR><TD><B>Events in</B></TD><TD>95</TD></TR><TR><TD><B>Events/sec</B></TD><TD>0</TD></TR><TR><TD><B>Messages out</B></TD><TD>95</TD></TR><TR><TD><B>Messages/sec
i want get the value of Messages out which has value 95 exists in same row.
can any one please help me on this?
otheus
2
Try replacing all <tokens> with spaces and then passing through awk:
sed 's/\(<[^>]*>\)/ /g;'
Now you will get:
Events in 95 Events/sec 0 Messages out 95 Messages/sec
With a little change, you can change the </TRs> into newlines, making it even easier for awk:
sed 's/\(<\/TR>\)/\n/g; s/\(<[^>]*>\)/ /g;'
Now you get:
Events in 95
Events/sec 0
Messages out 95
Messages/sec
Now you can pipe through awk:
<above sed command> | awk '/Messages out/ { print $NF }'
will always print the last field on a line matching "Messages out".