:>:
:>: for file
:>: do
:>: ed - $file <<-!
:>: 1d
:>: w
:>: q
:>: !
:>: done
:
:Good, but not quite there, Jon.
:
:>Less cryptic, shorter and no good:
^^^^^^^^^^^
Please don't alter text I wrote and then leave it attributed to me.
This is, at best, rude. I think you could have made your point without
resorting to forged attributions.
:>
:> for file
:> do
:> awk 'NR>1' $file
:> done
:
:Somehow, I don't think the goal of the exercise is to display all that
:text on the screen. You get to stay behind and clean the erasers.
Well, as Jon pointed out to me in email, his rewrites the file
whereas mine requires a (trivial) mod to write to a temp file and
mv it back.
If you will permit me:
for file
do
awk 'NR>1' $file > /tmp/tmp.$$
mv /tmp/tmp.$$ $file
done
Happy now?
Also, this will likely be more reliable after a system crash during
its execution, although I know systems don't crash any more these
days :-).
:The best solution is (in csh, since you are going to just do this from
:the command line - no reason to write a script for it
This I disagree with. There might be something continually running
in the background where one wants to keep the "last 10" of something
in a file (for example). It seems to me that this is the most
probable reason for wanting to do such a thing (but we can only guess
what the original poster's reasons were).
:- and of course,
:anyone with any self-respect is running tcsh [that's not flame bait at
:all, is it?]) :
I prefer tcsh interactively (because of "dirs -v", "=0" thru "=9",
and the ability to have *both* ^H and DEL as "erase" keys). So if they
flame, I'll defend you :-)
Cheers,
Stan.
--
HELP! I'M BEING HELD PRISONER IN A .SIGNATURE FACTORY!