File processing

David M. Cooke cookedm+news at physics.mcmaster.ca
Tue Jul 10 14:15:30 EDT 2001


At some point, Donn Cave <donn at drizzle.com> wrote:

> That's cool, but you might be interested to see if tail on
> your platform supports a positive index (bet it does):
> 
>     for f in `whole buncha files`
>     do
>         if tail +1 $f > $f.tmp
>         then mv $f.tmp $f
>         else rm $f.tmp
>         fi
>     done
> 
> In the unlikely event it doesn't, sed '1d' is a safe bet.

You want tail +2 -- that starts output on the second line. tail +1
starts on the first line (the beginning of the file).

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list