Hi I have a shell command like this.
s3=$(awk \'BEGIN{ print \"S3 bucket path\" } /Executing command\\(queryId/{ sub(/.*queryId=[^[:space:]]+: /,\"\"); q=$0 }
another approach can be, processing the file from the end and exiting after first match.
tac file | awk '/match/{print; exit}'