On Mon, 28 Jul 2003, Thomas David Rivers wrote:
> John,
>
> There's a simpler way... (perl is, typically, overkill.)
> To strip the blanks from a file, just use "sed":
>
> cat $file | sed "s/ *$//" > /tmp/strip.$$
> mv /tmp/strip.$$ $file
Well.
He already has a working Perl script. Less manpower to fix that than to
write a whole new script.
If you're going to use a shell script, I think you will find this model
both faster and safer: faster because the cat command is superflous, and
safer because it keeps the original, "just in case."
mv ${file{ ${file}~
sed <${file}~ >${file} \
-e "s/ *$//"
I've not tested mine either, but your sed's wrong;-)
--
Cheers
John.
Join the "Linux Support by Small Businesses" list at
http://mail.computerdatasafe.com.au/mailman/listinfo/lssb
Copyright John Summerfield. Reproduction prohibited.