viernes, 7 de junio de 2013

grep output only part of matching regex

$ echo 'ETag: "ae02fff4e2395982747582496ada225d"'
ETag: "ae02fff4e2395982747582496ada225d"
 

#I want just the ETag value:
$ echo 'ETag: "ae02fff4e2395982747582496ada225d"' |grep -oP '(?<=ETag: ")\w+(?=")'
ae02fff4e2395982747582496ada225d

Ref: http://unix.stackexchange.com/questions/13466/can-grep-output-only-specified-groupings-that-match