[ORIGINAL CREATION] tact and skill of sed

来源:互联网 发布:滴油雾化器绕丝数据 编辑:程序博客网 时间:2024/06/04 06:46

####

sed '/cryincold/ p' text                   // Print lines match "cryincold"
sed '/cryincold/! p' text                  // Print lines do NOT match "cryincold", pay attention to theexclamatory mark !

####
An & which is a special character in sed & awk is replaced by the matched substring. /& put literal &.

####
sed 110q filename    // print filename the first 110 lines
sed -n '10, 20p' filename      // print lines between 10 and 20

 

####

sed /^[[:space:]]*$/d  file_name  // Erase all space line.

 

####

sed -n 's/.*/[/(.*/)/].*//1/p' filename                   // get all section names between [ and ]