[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 13:43:24 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
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
Description: OpenPGP digital signature
Re: Confusing/unclear documentation of Sed back references, Peter Kehl, 2014/11/26