I need to extract the integer value from some log files. The integer value always appears after a substring
return code. But it may or may not have additional stuff after this substring. Below are two example entries:
Job with id 0 ended with status COMPLETED, return code 16, in 1 minute 12 seconds Job with id 0 COMPLETED with return code 255
So, here I want 16 in the first case, and 255 in the second case.
My initial approach was to use awk - but the column in which the required value occurs is not consistent; so it failed.
How do I achieve this in a reliable manner?