[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sed bug
From: |
Slawomir Kuszczynski |
Subject: |
sed bug |
Date: |
Thu, 14 Feb 2013 10:12:17 +0100 |
Hi,
I found bug in sed. It is related to reverse matching, see examples below:
Result of this simple sed:
echo ABC1234_1.0 | sed -r 's/^[A-Z]*([0-9])/\1/'
is:
1234_1.0
but should be:
1
This not happen in python2.7 and python3.2:
$ python -c "import re; print(re.sub(r'^[a-zA-Z]*([0-9]).*',r'\1',
'ABC1234_1.0'))"
1
Environment details:
$ sed --version
GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <address@hidden>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
$ uname -a
Linux jaaa 3.0.0-30-generic #47-Ubuntu SMP Wed Jan 2 23:16:29 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux
--
BR,
Slawomir Kuszczynski
- sed bug,
Slawomir Kuszczynski <=