sedSed is a stream editor. It is it's own Domain Specific Language.
s for substitutionUses regex, changes "day" to "night" from file "old" into file "new":
sed s/day/night/ < old >newsed is line oriented:
# file
one two three, one two three
four three two one
one hundred
sed 's/one/ONE' <file
ONE two three, one two three
four three two ONE
ONE hundreds substitute commandSay you need to search with slashes for file directories. It is advantageous to use another character, say _. Any character works, as long as it's 3 delimiters.
Say you want to put brackets around a word. & is a special character for the string that you matched. sed s/[a-z]*/(&)/ <old >new
-r for extended Regular ExpressionFor more advanced regex, like + meta-character. sed -r 's/../../'