Show a text file and replace text, here: replace foo with barsed s/foo/bar/g file.txt
Use ” if your search patterns contains spacessed 's/foo foo/bar bar/g' file.txt
Change a text file in place and replace text, here: replace foo with barsed s/foo/bar/g file.txt -i
Redirect output to Disksed s/foo/bar/g file.txt > newfile.txt
delete 5th linesed 5d file.text
Delete lines matching ‘foo’sed /foo/d file.txt
Print line 8sed -n '8p' file.txt
Print lines 8-10sed -n '8,10p' file.txt
Append new line containing ‘bar’, after lines containing ‘foo’sed '/foo/a bar' file.txt
Insert “hello” to the end of line 9sed 'i9 hello' file.txt
Examples:sed 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config