sed
Linux · Text · available in the simulator
What it does
Processes and transforms text using expressions.
Syntax
sed [opciones] 'script' [archivo...]
Options and parameters
-eAdds a command to the script.
sed -e 's/a/b/' -e 's/c/d/' f.txt-iEdits files in place; supports an optional backup suffix.
sed -i.bak 's/viejo/nuevo/g' f.txt-nSuppresses automatic printing of each line; typically used with the p command.
sed -n '5,10p' f.txt-EUses extended regular expressions.
s///gReplaces all occurrences in the line, not just the first.
sed 's/error/AVISO/g' log.txt
Usage examples
sed 's/foo/bar/g' archivosed -n '1,10p' archivosed -e 's/a/b/' -e 's/c/d/' f.txtsed -i.bak 's/viejo/nuevo/g' f.txtsed -n '5,10p' f.txtsed 's/error/AVISO/g' log.txt