Quantcast
Channel: User ozzy - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 31

Answer by ozzy for How to grep a line who has execution time greater than X

$
0
0

Assuming that the lines continue after "Lambda", as suggested by the OP, this command should work:

gawk 'match($0, /execution\stime:([0-9]+)s/, a) && a[1] > 10 { print $0 }' logfile

with 'logfile' being the name of the logfile (/root/.pm2/logs/proxy-out-1.log)

This solution uses the match function to capture the execution time as a parenthesized group, and then bases a numerical comparison on the captured value to decide if the line should be printed.

The longer but more portable version is:

awk 'match($0, /execution time:([0-9]+)s/) && substr($0, RSTART+15, RLENGTH-16 ) > 10 { print }' testfile

Viewing all articles
Browse latest Browse all 31

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>