[BusyBox] config.h/bb_config.h translation broken

Shaun Jackman sjackman at gmail.com
Tue Aug 2 16:00:16 UTC 2005


On 8/1/05, Paul Fox <pgf at brightstareng.com> wrote:
> i think inserting newlines with sed can be hard to do portably

The portable way to insert a newline in sed is using an escaped
literal newline character. I prefer the look of \n when it's supported
though.

sed 's/a/a0\
a1/'

Alternatively, you can use multiple print commands:

sed 'h; s/b/b0/; p; g; s/b/b1/'

In any case, this sed script translates #undef xxx to #define xxx 0
and CONFIG_xxx to BB_xxx.

sed 's/^#undef\(.*\)/#define\1 0/; s/ CONFIG_/ BB_/' < config.h > bb_config.h

Cheers,
Shaun



More information about the busybox mailing list