Linux sed commands

[root@localhost /]# cat /home/sed.txt
use python with nginx to build webapp
python php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn python and php is fun. use python and php to build app is great
sed ‘s/python/go/’ /home/sed.txt
use go with nginx to build webapp
go php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn go and php is fun. use python and php to build app is great
sed ‘s/python/go/g’ /home/sed.txt
use go with nginx to build webapp
go php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn go and php is fun. use go and php to build app is great
sed ‘s/python/go/2’ /home/sed.txt
use python with nginx to build webapp
python php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn python and php is fun. use go and php to build app is great
sed ‘$ s/python/go/g’ /home/sed.txt
use python with nginx to build webapp
python php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn go and php is fun. use go and php to build app is great
[root@localhost /]# sed ‘2,3 s/python/go/g’ /home/sed.txt
use python with nginx to build webapp
go php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn python and php is fun. use python and php to build app is great
[root@localhost /]# sed -n ‘s/python/go/gp’ /home/sed.txt
use go with nginx to build webapp
go php c java are programming languages
learn go and php is fun. use go and php to build app is great
sed ‘3d’ /home/sed.txt
use python with nginx to build webapp
python php c java are programming languages
grep sed and awk is useful to processing text
learn python and php is fun. use python and php to build app is great
[root@localhost /]# sed ‘1,3d’ /home/sed.txt
grep sed and awk is useful to processing text
learn python and php is fun. use python and php to build app is great
[root@localhost /]# sed ‘/python/d’ /home/sed.txt
linux is friendly to developer
grep sed and awk is useful to processing text
sed ‘/languages/a ++’ /home/sed.txt
use python with nginx to build webapp
python php c java are programming languages
++
linux is friendly to developer
grep sed and awk is useful to processing text
learn python and php is fun. use python and php to build app is great
sed ‘s/python/& language/’ /home/sed.txt
use python language with nginx to build webapp
python language php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn python language and php is fun. use python and php to build app is great
[root@localhost /]# sed -i ‘s/python/& script/g’ /home/sed.txt
[root@localhost /]# cat /home/sed.txt
use python script with nginx to build webapp
python script php c java are programming languages
linux is friendly to developer
grep sed and awk is useful to processing text
learn python script and php is fun. use python script and php to build app is great
$ cat data11.txt
python, php
linux, windows
c, python
$ sed -n '/python/w py.txt' data11.txt
$ cat py.txt
python, php
c, python
cat data.txt
echo 1.
echo 2.
echo 3.
echo 4.
echo 1 again.
sed 'y/123/789/' data8.txt
echo 7.
echo 8.
echo 9.
echo 4.
echo 7 again.
cat data1.txt
1
2
cat data2.txt
a
b
sed '3r data1.txt' data2.txt
a
b
1
2
c

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
LORY

LORY

A Senior Software Developer/Body builder . to help others enjoy coding and stay healthy