how to select the last line of the shell output

后端 未结 3 401
甜味超标
甜味超标 2021-01-26 03:34

Hi I have a shell command like this.

s3=$(awk \'BEGIN{ print \"S3 bucket path\" }
 /Executing command\\(queryId/{ sub(/.*queryId=[^[:space:]]+: /,\"\"); q=$0 }
          


        
3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-26 04:16

    another approach can be, processing the file from the end and exiting after first match.

    tac file | awk '/match/{print; exit}'
    

提交回复
热议问题