sed学习笔记(一)--选项
时间:2007-12-19 来源:kinwin
sed OPTIONS... [SCRIPT] [INPUTFILE...] |
options:
-n 默认不打印模式空间的内容 |
-i[SUFFIX] 直接修改文件的内容,GNU sed输出到一个临时文件而非标准输出,然后将临时文件重命名为当前文件。若SUFFIX非空,则在移动临时文件前先备份当前文件。 例:
|
$ cat new hello,everyone
kinwin@ustc-king:~
$ sed -icp '1c\Great' new
kinwin@ustc-king:~ $ ll new*
-rw-r--r-- 1 kinwin kinwin 6 2007-12-19 20:59 new
-rw-r--r-- 1 kinwin kinwin 15 2007-12-19 20:58 newcp
kinwin@ustc-king:~ $ cat new Great kinwin@ustc-king:~ $ cat newcp hello,everyone $ sed -i/home/kinwin/1*2 '1c\test' newkinwin@ustc-king:~ $ cat 1new2 Great kinwin@ustc-king:~ $ cat new test *被替换为原文件名 |
|
--posix 用posix标准的sed |
-r 使用增强的正则表达式(egrep) |
-s 将要处理的files视为多个文件,默认sed将他们处理为一个文件流 |
-u Buffer both input and output as minimally as practical. |
-e 'script' -f script file If no -e, -f, --expression, or --file options are given on the command-line, then the first non-option argument on the command line is taken to be the script to be executed |
- 系统休眠文件删除后果 如何删除计算机的休眠文件 2025-04-22
- 站群服务器是什么意思 站群服务器的作用 站群服务器和普通服务器的区别 2025-04-22
- jQuery插件有何作用 jQuery插件的使用方法 2025-04-22
- jQuery插件有哪些种类 简单的jQuery插件实例 2025-04-22
-