I saw many examples, but for some reason it still does not work for me.
This is the command I'm executing:
NUMBER=$(docker logs vault | grep Token)
NUMBER=${NUMBER##*": "}
NUMBER=$(echo $NUMBER | sed 's/^token=(.*)$//g')
echo $NUMBER
I want to get the value after '=', which is a string basically. I tried using GREP, and other regex's but I either get nothing, or just the original string.
Please advise.
()
capture groups with Basic Regular Expressions, where they have to be\(\)
(or use ERE instead,sed -E
/sed -r
) and b) you're removing the complete line, but you want to re-insert the captured group again.cut
hereecho 'token=dsa32e3' | cut -d= -f2
number=$(echo token=dsa32e3);number=${number#*=}