User Tools

Site Tools


bash:strings:find_replace

This is an old revision of the document!


BASH - Strings - Find & Replace

var="abcdabe"
 
echo ${var/ab/fg}

returns:

fgcdabe

NOTE: Only the first match is changed.

To change all occurrences use:

var="abcdabe"
 
echo ${var//ab/fg}

returns:

fgcdfge

bash/strings/find_replace.1612972756.txt.gz · Last modified: 2021/02/10 15:59 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki