[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Confusing/unclear documentation of Sed back references
From: |
Eric Blake |
Subject: |
Re: Confusing/unclear documentation of Sed back references |
Date: |
Wed, 26 Nov 2014 12:40:21 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
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
Description: OpenPGP digital signature
Re: Confusing/unclear documentation of Sed back references, Peter Kehl, 2014/11/26