[ dropped bug-libtool ] * Peter Rosin wrote on Sat, Oct 02, 2010 at 01:42:02PM CEST: > Den 2010-10-02 08:32 skrev Ralf Wildenhues: > >> + $SED -n -e ' > >> +s/^\(.\{79\}\)\(..*\)/\1\n\2/ > > > > \n is portable only in the regex part, but not in the replacement part. > > For that you need backslash then literal newline. > > Ok, so replacing with > > s/^\(.\{79\}\)\(..*\)/\1\ > \2/ > > is portable?
Yes. Well, we might get the odd report about the Cygwin non-binmode mount where the CR NL messes up things, but otherwise, it should work. > >> +h > >> +s/\([\\"]\)/\\\1/g > >> +s/$/\\n/ > >> +s/\([^\n]*\).*/ fputs ("\1", f);/p > > > > Why not above, right after h, do s/\n.*// and then simplify this s > > command? > > > >> +g > >> +D' > > Because then we no longer know if the C-string "\n" at the end of the > line (added by the 's/$/\\n/' statement) should be inserted or not. > The trick is to add it and then cut it out if the string was too long > (contains a literal newline from the s command). We can only have > the "\n" for the final chunk, otherwise the output will be riddled > with too many newlines. Ah yes, thinko of mine, thanks for explaining. Cheers, Ralf