I'm pretty new at bash so this is a pretty noob question..
Suppose I have a string:
string1 [string2] string3 string4
I would like to extract string2
from the square brackets; but the brackets may be surrounding any other string at any other time.
How would I use sed
, etc, to do this? Thanks!