跳至主要內容

sed

Mr.Hope...小于 1 分钟

sed

sed 命令用于对文本进行过滤和变形处理。

下面是 example.txt 文件的内容。

Hello This is a Test 1 2 3 4
replace all spaces with hyphens

sed 命令将所有的空格换成连词线 -

$ sed 's/ /-/g' example.txt
Hello-This-is-a-Test-1-2-3-4

下面的命令将数字换成字母 d

$ sed 's/[0-9]/d/g' example.txt
Hello This is a Test d d d d
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.1.3