Re: Confusing/unclear documentation of Sed back references

Eric Blake <[email protected]> Wed, 26 Nov 2014 12:40:21 -0700
Newsgroups gmane.comp.gnu.utils.bugs
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 11/26/2014 12:29 PM, Bob Proulx wrote:
> 
> The invocation section documents the -r option.
> 
>   https://www.gnu.org/software/sed/manual/sed.html#Invoking-sed
> 
>   -r
>   --regexp-extended
>       Use extended regular expressions rather than basic regular
>       expressions.  Extended regexps are those that egrep accepts;
>       they can be clearer because they usually have less backslashes,
>       but are a GNU extension and hence scripts that use them are not
>       portable.  See [Extended regular expressions].

This is no longer entirely true.  POSIX has proposed standardizing the
-E synonym of -r, which means that it IS portable to use 'sed -E' to get
extended regular expressions in modern sed implementations, and that it
is no longer a GNU-only extension:
http://austingroupbugs.net/view.php?id=528
(However, it is still true that the spelling 'sed -r' is still a GNU
extension, and you should get used to 'sed -E' instead)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 539 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg

iQEcBAEBCAAGBQJUdiylAAoJEKeha0olJ0Nq5FUH/RFaultxgKimiwpR5XfG4Nyj
JCH9taG+Krr1qsw4BnnB2y0/9z3/t/Lm6tcaaN5i5pffQ4MJTersOU5kzBjGJGeq
CPD7PhuTxJppzMmLDkQjuQc6O9tD4jxxtqlnH5Tkg9wiEbJsQ555R0FXrMCEn6fU
iSXXclUctsfKp5VNwIa03OVsYj/5wYqlLsNpubzwHi19hPMrG0z+0BoSuTn/Lo0W
qo5hi1D0MN85x4d2IWa7xWCkGfwdYLwGNN3FetP2XbiKyxJaswCg1d8xdv1nWrw6
OC5FrbdRTwb3bR22XCYRLtTri6+eA3aP50pmR6d9dV/filu+xGjwEUMTUuBTHBA=
=ZgzR
-----END PGP SIGNATURE-----