cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

os:linux:command:sed.html



Linux Commands Cheat Sheet

How to use sed Command in Linux

man sed

NAME
       sed - stream editor for filtering and transforming text


       -e script, --expression=script
              add the script to the commands to be executed

       -i[SUFFIX], --in-place[=SUFFIX]
              edit files in place (makes backup if SUFFIX supplied)


Example

sed -i  "s/IPADDR=192.168.0.10/IPADDR=192.168.0.11/g"  ifcfg-eth0 
cat input.txt | sed -e 's/xxx/XXX/g' > output.txt
sed -e 's/xxx/XXX/g' input.txt > output.txt
sed -e '
  s/A/a/g
  s/C/c/g
  s/G/g/g
  s/T/t/g' input.txt
sed -f sample.sed input.txt



os/linux/command/sed.html.txt ยท Last modified: 2018/08/08 by admin

Page Tools