Re: Confusing/unclear documentation of Sed back references
Eric Blake <[email protected]> Wed, 26 Nov 2014 13:43:24 -0700
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Organization | Red Hat, Inc. |
| Message-ID | <[email protected]> |
On 11/26/2014 12:54 PM, Bob Proulx wrote:
>> 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:
> I don't see how you can see that isn't entirely true. As I read
> things the -E is still a proposal. At this time no sed -E option yet
> exists in GNU sed.
It is documented in sed.git:
$ ./sed/sed --help | grep -A1 -- -E
-E, -r, --regexp-extended
use extended regular expressions in the script
(for portability use POSIX -E).
-s, --separate
and exists (albeit undocumented) in older sed:
$ sed --version | head -n1
sed (GNU sed) 4.2.2
$ echo abc | sed -E 's/(b)/B/'
aBc
Hmm - that means we haven't had a sed release in quite a while; 4.2.2
came out in 2012. Maybe this thread will spur a release.
> It certainly can't be considered portable. Not even in bleeding edge
> systems.
I agree that it is not portable to older systems, but DOES work on
existing GNU and BSD sed implementations (even if it is undocumented in
GNU sed).
--
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 iQEcBAEBCAAGBQJUdjtsAAoJEKeha0olJ0NqLcUH/1GN6Ujet2U1eEvYJZuXIV2o UWRVXjsOim/9I3SMwMpkZ0a1Ww334h5VaPKyhnc5hDppCCzD766AgZN2vcHhE9WL 9vkqAHuCHgwDDtAbwyyjYsfN7tiQYac/t3AprkJuXgbHD6UZTC0NfMj7rQ/9NKbL 9nOA7mJ8lWQ8rt8r6pzK7dzXjs37YQQZq+wGR625H9w4XV0TQ7A+W9dXOEZjd169 fGfnsIXD5nbrbp4VSNViCfJ4eSfj+ppUBL60xqcKVzNWYWonMGynRMaAAJwmiTHD FLDkh2NB64aH+NFBd8r+BhZY4FdBiTkOzmGyV7ct5defRVRX+6/D6RtETTKrLrU= =D9fN -----END PGP SIGNATURE-----