On Mon, 28 Jul 2003, Thomas David Rivers wrote:
> > 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;-)
> >
>
> Oops - I think you have a typo there in the first line.
h.
>
> But - none-the-less; my sed is right - you don't have to have
> the -e. The traditional (pre-GNU) format didn't require
> the -e... the syntax was simply
I was sure that one of my many past mistakes was omitting the '-e.'
Perhaps I had two scripts then:
Not being willing to trust people;-) I put it to the test:
[EMAIL PROTECTED] summer]$ sed </dev/null >/dev/null s=f=g=
[EMAIL PROTECTED] summer]$ sed </dev/null >/dev/null s=f=g= s=f=g=
sed: can't read s=f=g=: No such file or directory
I didn't know about the file arguments either. Looks to me that these
are equivalient
cat a b c d
sed s=a=a= a b c d
(I use equals because slashes are more-often in strings I want to
change).
>
> sed [-Ean] command [file ...]
>
> It is nice that you script preserves the original file - a much
> better idea!
Took me years to think of it. But then, it's what we did back in the
days of batch processing. We always kept the input files.
--
Cheers
John.
Join the "Linux Support by Small Businesses" list at
http://mail.computerdatasafe.com.au/mailman/listinfo/lssb
Copyright John Summerfield. Reproduction prohibited.