Linux Three Musketeers sed to explain the depth of practice (under)

Alternatively 2.3.4 packet \ (\) and \ 1 will be described using

 

 

echo I am dongdaxia yingxiong. |sed 's#^.*am \([a-z].*\) yin.*$#\1#g'

 

 

echo I am dongdaxia yingxiong. |sed -r 's#^.*am (.*) yin.*$#\1#g'

 

 

 2.3.5 special symbol & represents Replaced

 

 sed '1,3s#C#--&--#g' person.txt 

 

 

 

ls *jpg |sed -r 's#(^.*)_finished.*#mv & \1.jpg#g' |bash

 

 

2.4 check

    p output specified content, but the default output 2 matches, so using n cancel the default output.

2.4.1 row query

 

 

In general, taking with sed line is the simplest.

 

 

2.4.2 query by a string

 

 2.4.3 Mixed inquiry

 

Guess you like

Origin www.cnblogs.com/dongxu2019/p/11584276.html