sed
)The sed
command is a powerful stream editor used for text manipulation. It can be used to perform various text transformations, such as finding and replacing text in files or streams.
The sed
command is a powerful stream editor used for text manipulation. It can be used to perform various text transformations, such as finding and replacing text in files or streams.
sed 's/find/replace/' [file]
s
: Stands for "substitute."find
: The text or pattern you want to search for.replace
: The replacement text.file
: The file you want to modify.By default, sed
prints the modified content to the terminal without changing the original file. You can use the -i
option to edit files in-place.
sed 's/old/new/' file.txt
Example:
File file.txt
contains:
The old car is rusty.
Command:
sed 's/old/new/' file.txt