Sed 的man手册参数详细解释(一)

 

NAME

sed - stream editor for filtering and transforming text

SYNOPSIS

sed [OPTION]... {script-only-if-no-other-script} [input-file]...

DESCRIPTIONSed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).

While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed’s ability to filter text in a pipeline which particularly distinguishes it from other types of editors.

中文翻译:Sed 是一个流编辑器,用于处理来自文件或者管道的标准文本的转换工作,尽管在某些方面类似于允许脚本编辑的编辑器,但是由于sed仅仅对其输入进行一次扫面,因此比起其他交互编辑器,sed更加高效。同时由于sed过滤来自管道中的文本,使得它变得与众不同。

补充:Sed把当前处理的行存储在称为模式空间(pattern space)的临时缓冲区中。一旦sed完成对模式空间按中的行的处理,模式空间中的行就被送往屏幕(除非命令是删除行或者打印到打印机),行被处理完成以后,就被移出模式空间,程序接着读入下一行,处理、显示、移出……文件输入的最后一行被处理完以后,sed结束,通过在临时缓冲区存储每一行,然后再缓冲区中操作该行,保证原始文件不会被破坏。

-n, --quiet, --silent

suppress automatic printing of pattern space

取消将模式空间中的内容自动打印出来。

解释:也就是说除非指定选项-n,否则sed每执行到命令最后,都会输出存在于模式空间中的行,也就是处理完缓冲到模式空间中的行以后自动输出模式空间的内容,同时如果有p指令,还会在输出p指令指定的行,而当在命令行中使用-n选项以后,这种自动工作被禁止,如果使

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值