01 2020 档案
摘要:\反斜线,转义特殊字符 $ cat data2 The cost is $4.00 $ sed -n '/\$/p' data2 The cost is $4.00 锚字符 ^匹配行首 $ cat data3 This is a test line. this is another test line. A line that tests this feature. Yet more testin
阅读全文
摘要:1 替换字符,正斜线(/) 2 sed 's!/bin/bash/!/bin/csh/!' /etc/passwd 3 ying:x:1000:1000::/home/ying:/bin/bash 4 laiying:x:1001:1002::/home/laiying:/bin/bash 1 替换指定行的文本 2 cat data1.txt 3 替换第2行的字符 4 sed '2s/dog/ca
阅读全文
摘要:sed编辑器被称作流编辑器(stream editor),和普通的交互式文本编辑器恰好相反。在交互式 文本编辑器中(比如vim),你可以用键盘命令来交互式地插入、删除或替换数据中的文本。流编 辑器则会在编辑器处理数据之前基于预先提供的一组规则来编辑数据流。 sed命令选项 -e script 在处理
阅读全文