Instead of escaping all special characters for the shell as ; & and so on you can write
sed -e 's/;/asdf/g' file.ext
sed -f sed-script.sed file > output.txt script | sed -f sed_script.sed > output
syntax:
sed '[address1[,adress2]]command' [file(s)]
sed -n '13,17p' file.dat
sed -n '/pattern/p' file.dat
There is the possibility to give more than one command with syntax
address{command1;command2;...} sed -n '{p; s/searchpattern/replacepattern/g ; p }' file.dat
a append c change d delete g get buffer G get newline h hold buffer H hold newline i insert l listing n next p print q quit r read s substitute x xchange y yank replace char y/sourcechar/replacechar/ w write ! negation
options for s/.../.../option
g global p output w swaps content of temp mem with selected line
examples:
sed '5,$d' file.dat
sed '/pattern/d' file.dat
sed '/!pattern/d' fild.dat
sed -n '/pattern/{p;q}' file.data
sed '/pattern/ s/searchpattern/replacepattern/' file.dat