On Aug 2, 2007, at 11:58 PM, John Baxter wrote: > As to your missing whitespace, you could try replacing the > echo $i > with > echo "$i" > > That has to be double-quotes--single quotes would cause your output > to be a series of lines containing the literal $i Keeping all the different quotes straight--single quotes, double quotes, backquotes--has to be one of the hardest things about learning shell scripting. > That should present the whole line to echo as a single argument, > and in that case echo won't mess with whitespace inside the > argument. With just $i, the $i is indeed the whole line, but echo > sees it as a series of arguments (word-like things), and emits them > with a space separating them. It's not what echo is doing to i; it's how for is interpreting the output of cat and putting it into i. When you pass a list to for, that list can be space-, tab- or return-delimited, or any combination thereof, so it sees each line as a list if it has spaces in it. > An alternative would be to replace the echo with col, but I think > that would have trouble with any line starting with a hyphen. I've already finished the script, but I'll play around with col tomorrow to see how it works. I'll check out those books too. I already have the O'Reilly book on csh and tcsh, but it explicitly says it doesn't cover shell scripting. So does my Learning Unix for Mac OS X. I have two books that say they don't cover shell scripting, so I guess it was preordained that I'd have to learn shell scripting. :-/ Thanks for the suggestions.