Ravi Sir's Cards › AWS
${s//a/b} vs sed 's/a/b/g'
This comparison card contrasts ${s//a/b} and sed 's/a/b/g'. ${s//a/b} is described as built in, one variable. sed 's/a/b/g' is described as external, streams and files. The card pairs ${s//a/b} with inside loops, and sed 's/a/b/g' with whole files.
Read card text
What this card says
Replace
${s//a/b}
Built in, one variable.
sed 's/a/b/g'
External, streams and files.
Key points
No new process.
Full regex.
Example
${s// /_}
Use when
Inside loops.
Whole files.