.bash_profile sed: \1 not defined in the RE

You should use \(.*\) instead of (.*).

sed uses Basic Regular Expressions (BRE) by default, which uses \( and \) for group capturing, not just ( and ) as used in Extended Regular Expressions (ERE). Since your expression used (.*) instead of \(.*\), it is not recognised as a group capture, and thus nothing is captured for use with \1.

Some sed implementations, such as the ones provided by GNU and BSD, do have an extension for specifying the use of ERE, but it is not specified by POSIX, and you cannot use it if you want to be portable.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)