Whats the difference between sed -E and sed -e

后端 未结 1 991
北恋
北恋 2020-12-01 16:11

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

but I no

相关标签:
1条回答
  • 2020-12-01 16:44

    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;
    

    And from manual, -E in BSD sed is used to support extended regular expressions.

    0 讨论(0)
提交回复
热议问题