2013-08-24 01:00:37 +02:00
|
|
|
# To replace all occurrences of "day" with "night" and write to stdout:
|
2013-08-21 06:17:52 +02:00
|
|
|
sed 's/day/night/g' file.txt
|
2013-08-11 21:37:11 +02:00
|
|
|
|
2013-08-24 01:00:37 +02:00
|
|
|
# To replace all occurrences of "day" with "night" within file.txt:
|
2013-08-21 06:17:52 +02:00
|
|
|
sed -i 's/day/night/g' file.txt
|
2013-08-11 21:37:11 +02:00
|
|
|
|
2013-08-24 01:00:37 +02:00
|
|
|
# To replace all occurrences of "day" with "night" on stdin:
|
2013-08-21 06:17:52 +02:00
|
|
|
echo 'It is daytime' | sed 's/day/night/g'
|