in reply to one liner string extraction
G'day natxo,
Would this be a simpler solution for what you're trying to achieve?
$ perl -nle 'next unless /^(.*?) INFO .*? SENT/; $x = $1; END { print +$x }' ts1 INFO ... SENT ts2 INFO ... RECV ts3 INFO ... SENT ts4 INFO ... RECV ts3
Skip unless match, otherwise save capture. Print last capture at the end.
I used STDIN (keyboard) for dummy logfile records:
ts1 INFO ... SENT ts2 INFO ... RECV ts3 INFO ... SENT ts4 INFO ... RECV
Output last matching timestamp: ts3
— Ken
|
|---|