Replace pattern in string
suggest changeFirst match:
$ a='I am a string'
$ echo "${a/a/A}"
I Am a stringAll matches:
$ echo "${a//a/A}"
I Am A stringMatch at the beginning:
$ echo "${a/#I/y}"
y am a stringMatch at the end:
$ echo "${a/%g/N}"
I am a strinNReplace a pattern with nothing:
$ echo "${a/g/}"
I am a strinAdd prefix to array items:
$ A=(hello world)
$ echo "${A[@]/#/R}"
Rhello Rworld
  Found a mistake? Have a question or improvement idea?
  Let me know.
      
      Table Of Contents