本文介绍了sed -E和sedee之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理一些旧的代码,我发现我曾经使用
I'm working on some old code and I found that I used to use
sed -E 's/findText/replaceWith/g' #findText would contain a regex
但我现在尝试
sed -e 's/findText/replaceWith/g'
似乎做同样的事情,还是做?
我记得有一个理由我做了它,但我不记得和做男人sed没有帮助,因为他们没有什么关于 - 只有 - 这并不太有意义以太网。
It seems to do the same thing, or does it?I kinda remember there being a reason I done it but I can't remember and doing "man sed" doesn't help as they don't have anything about -E only -e that doesn't make much sense ether.
-e, --expression=script
Append the editing commands in script to the end of
the editing command script. script may contain more
than one newline separated command.
我以为 - 这意味着它会与正则表达式匹配...
I thought -e meant it would match with a regex...
GNU sed version 4.2.1
推荐答案
从源代码中, -E
是一种与BSD sed兼容的无证选项。
From source code, -E
is an undocumented option for compatibility with BSD sed.
/* Undocumented, for compatibility with BSD sed. */
case 'E':
case 'r':
if (extended_regexp_flags)
usage(4);
extended_regexp_flags = REG_EXTENDED;
break;
而从,BSD中的 -E
sed用于支持扩展正则表达式。
And from manual, -E
in BSD sed is used to support extended regular expressions.
这篇关于sed -E和sedee之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!