Pretty simple grep
using options -o
/ --only-matching
and -P
/ --perl-regexp
(available in GNU grep
):
$ grep -oP 'nonce="\K[^"]+' output.txt
/wcUEQOqUEoS64zKDHEUgg==
-o
, nonce="
, reset match start escape-, PCRE.
, output.txt
( ) nonce, , -m1
( ):
$ grep -oPm1 'nonce="\K[^"]+' output.txt
nonce , substitution; openssl sha1
, :
$ nonce=$(grep -oPm1 'nonce="\K[^"]+' output.txt)
$ echo "$nonce"
/wcUEQOqUEoS64zKDHEUgg==
$ read hash _ <<<"$(grep -oPm1 'nonce="\K[^"]+' output.txt | openssl sha1 -r)"
$ echo "$hash"
2277ef32822c37b5c2b1018954f750163148edea