Min*_*int 18 regex linux debian sed
我正在研究一些旧代码,我发现我曾经使用过
sed -E 's/findText/replaceWith/g' #findText would contain a regex
但我现在试试
sed -e 's/findText/replaceWith/g'
它似乎做同样的事情,或者它呢?我有点记得有一个原因我做了但我不记得并且做"man sed"没有帮助,因为他们没有任何关于-E only -e,这没有太多意义以太.
-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.
我想 - 这意味着它会与正则表达式相匹配......
GNU sed version 4.2.1
小智 32
源代码,-E是一个未记录的选项,与BSD sed兼容.
/* Undocumented, for compatibility with BSD sed.  */
case 'E':
case 'r':
  if (extended_regexp_flags)
    usage(4);
  extended_regexp_flags = REG_EXTENDED;
  break;
从手册中,-E在BSD中,sed用于支持扩展的正则表达式.