sed

Parameters:
Name Type Required Default Hint
inputOrFile string true The text to process, or a file name to read with --file
commands string true The command to perform on the input text. Ex: s/replaceMe/withMe/g
file boolean false false Specifiy true to treat the input as a file path to read.

Command Usage

Stream editor command for manipulating text one line at a time. Sed is similar to the
many Unix implementations, but only supports the "s" command (substitute) currently.
Pass or pipe the text to process or a filename along with the --file flag.

sed "hello world" s/hello/goodbye/

Outputs: "goodbye world"
The substitute command syntax is "s/replaceMe/withMe/" where "s" is the command,
"replaceMe" is a CFML regular expression, and "withMe" is a replacement expression.

Supported pattern flags are "g" (global) which replaces all instances per line, and
"i" (ignore case) which makes the replacement case-insensitive.
echo "one hundred and one" | sed s/ONE/two/gi

Outputs: "two hundred and two"
All other regex rules follow what is implemented in REReplace() CFML function.

The delimiter in the subsdtitute command does not have to be "/". Whatever character
that immediatley follows the "s" will be used. This can be useful where the regex
and/or replacement text contain a "/".

This example uses a tilde (~) as the delimiter. It reads a file, replaces all instances
of a given file path, and writes the file back out.
sed --file config.cfm s~/var/www/~/sites/wwwroot/~i > config.cfm