Skip to content

Commit

Permalink
Merge pull request #2 from raw34/patch-1
Browse files Browse the repository at this point in the history
Update 03_text_processing.rst
  • Loading branch information
me115 committed Feb 15, 2015
2 parents 123c7f9 + b154683 commit c8da0ae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/03_text_processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,15 @@ sed 文本替换利器
- 首处替换
::

seg 's/text/replace_text/' file //替换每一行的第一处匹配的text
sed 's/text/replace_text/' file //替换每一行的第一处匹配的text
- 全局替换
::

seg 's/text/replace_text/g' file
sed 's/text/replace_text/g' file

默认替换后,输出替换后的内容,如果需要直接替换原文件,使用-i::

seg -i 's/text/repalce_text/g' file
sed -i 's/text/repalce_text/g' file

- 移除空白行
::
Expand All @@ -322,7 +322,7 @@ sed 文本替换利器
已匹配的字符串通过标记&来引用.
::

echo this is en example | seg 's/\w+/[&]/g'
echo this is en example | sed 's/\w+/[&]/g'
$>[this] [is] [en] [example]


Expand Down

0 comments on commit c8da0ae

Please sign in to comment.