sed replace all character code example
Example 1: php replace space with underscore
$str = str_replace(' ', '_', $str);
Example 2: replace text with sed
sed -i 's/old-text/new-text/g' input.txt
$str = str_replace(' ', '_', $str);
sed -i 's/old-text/new-text/g' input.txt