Breaking large file into pieces

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Wed Sep 12 12:43:46 AEST 1990


Larry:
> Dan:
> : Larry:
> : > Dan:
> : > : Larry:
> : > : >     echo "$line"
        [should be echo -n "$line$n" or echo -n "$line"; echo ]
      [but that fails on \c machines ]
    [preprocess with sed 's-\\-\\\\-g' or various others ]
> But "hmph", yourself.  You still haven't posted "a solution that ALSO works
> on all the \c machines."  Your -n solution doesn't work on a \c machine,
> and your \c solution doesn't work on a -n machine.  At least it's symmetrical.

Oh, gimme a break. Your suggestion of switching to SVR4 doesn't work on
any machine. :-) It's trivial to select between the two scripts with an
echo test. There: a perfectly portable sh solution to the problem that
started this thread.

> (By the way, what makes you think s/\\\\/\\\\\\\\/ is a solution?  It only
> translates \\, not \c.)

Oh dear. Not paying attention to your quoting? sed s/\\\\/\\\\\\\\/ is
translated by the shell into sed s/\\/\\\\/, which is translated by sed
into s/\/\\/, which is what we want. \c becomes \\c, which is parsed
(correctly) as backslash-c. What makes you think this isn't a solution?

---Dan



More information about the Comp.unix.shell mailing list