Replace pattern in string

suggest change

First match:

$ a='I am a string'
$ echo "${a/a/A}"
I Am a string

All matches:

$ echo "${a//a/A}"
I Am A string

Match at the beginning:

$ echo "${a/#I/y}"
y am a string

Match at the end:

$ echo "${a/%g/N}"
I am a strinN

Replace a pattern with nothing:

$ echo "${a/g/}"
I am a strin

Add prefix to array items:

$ A=(hello world)
$ echo "${A[@]/#/R}"
Rhello Rworld

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents