I usually use the bash pattern substitution ${parameter/pattern/string} and I wonder if there are any substitution string metcharacters like & in other tools (for instance sed, awk).
I'm trying to use the bash pattern substitution to insert 0x just before each pair of hexadecimal digits: 1a0e22fe ---> 0x1a 0x0e 0x22 0xfe
If & worked like in sed and awk, it would be so easy:
S=1a0e22ff
echo "${S//??/ 0x&}"
Are there metachars in substitution string?
I'm afraid no. This is too complex for Bash. Using a tool like
sedinstead is better.