Bash: replacing a substring in pipe stdin Bash: replacing a substring in pipe stdin bash bash

Bash: replacing a substring in pipe stdin


You can use the command sed.

cat file1 file2 | sed -e 's/@path_to_file/path/to/file/' ...


With Parameter Expansion:

cat file1 file2 | while read -r line; do echo "${line/@path_to_file/path\/to\/file}"; done