I have string looks likes this
string="xxxxx.yyyyy[2].zzzzz"
I want to extract the number between the [ ]
. I used the following awk
command
echo $string | awk -F'[]' '{print $2}'
But this awk
command returns error:
awk: bad regex '[]': Unmatched [ or [^
How to fix that?