File processing

David M. Cooke cookedm+news at
Tue Jul 10 20:15:30 CEST 2001

At some point, Donn Cave <donn at> 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

More information about the Python-list mailing list