On Fri, 13 Jan 2012, Bernd Petrovitsch wrote:
> On Fre, 2012-01-13 at 10:28 +0100, Natanael Copa wrote:
> [...]
> > When building xen it fails with a sed expression. Building with
> > GNU sed works.
What busybox version was that?
> > $ busybox sed -n
> > 's,^\#define[[:space:]]\{1\,\}BOOT_TRAMPOLINE[[:space:]]\{1\,\},,p'
> > sed: bad regex
> > '^\#define[[:space:]]\{1\,\}BOOT_TRAMPOLINE[[:space:]]\{1\,\}':
> > Invalid content of \{\}
>
> The line looks over-quoted as it is in single quotes and IMHO the
> following was actually intended (or do I just miss a quoting level):
> 's,^#define[[:space:]]{1,}BOOT_TRAMPOLINE[[:space:]]{1,},,p'
>
> > I have not investigated if the sed line could be rewritten in a
> > standards compliant way or if its a bug in busybox sed.
>
> "{1,}" is equivalent to "+", so
> 's/^#define[[:space:]]+BOOT_TRAMPOLINE[[:space:]]+//p'
That's extended regex, so a '-r' is required.
> should be equivalent (and since we have no path names, we can use "/").
Or a more neutral delimiter, like '|'. And I don't think you want to
use character class '[:space:]'. What you're should use is
'[:blank:]'. A more robust regex:
$ busybox sed -rne \
's|^[[:blank:]]*#[[:blank:]]*define[[:blank:]]+BOOT_TRAMPOLINE[[:blank:]]+||p'
Cheers,
--
Cristian
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox