Print every lines of a file where last field value is > N

Consider the following scenario where the last filed of each line is basically the time taken to server a request by the app server – in our case it is ( say time=400ms). Now I want to see those lines which takes more than 400ms to server the request – here is the trick

cat prod_debug.log | grep ‘PROFILER’ | awk ‘{ sub(/time=/,””);print}’ | awk ‘{sub(/ms/,””);print}’ | awk ‘$NF>400’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: