Path: utzoo!attcan!uunet!samsung!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.unix.shell Subject: Re: Breaking large file into pieces Message-ID: <9480@jpl-devvax.JPL.NASA.GOV> Date: 12 Sep 90 16:19:53 GMT References: <9469@jpl-devvax.JPL.NASA.GOV> <23529:Sep1122:52:3790@kramden.acf.nyu.edu> <9472@jpl-devvax.JPL.NASA.GOV> <24879:Sep1202:43:4690@kramden.acf.nyu.edu> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 49 In article <24879:Sep1202:43:4690@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: : 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. :-) True enough, but I wasn't suggesting that. I was only asking you not to suggest it. I suggest we drop this one before someone else suggests that we do so... : 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. Ah, but as you know, I don't believe in fancy portability checks in shell scripts... :-) :-) :-) The quibble still stands that echo isn't built into everyone's shell. : > (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? Oops, you got me there. It's not that I didn't see the non-quotes, it's that I didn't see the "sed" on the front. So I wasn't thinking of it as a shell command. (Odd, considering what newsgroup we're in.) But it just goes to show you the problems associated with remembering all the multiple levels of interpretation that might happen. At least in my feeble brain. We outlawed the "goto" statement where it reduced understanding. Three or more backslashes in a row should be considered harmful. Larry