File processing

Harald Kirsch kirschh at lionbioscience.com
Tue Jul 10 03:30:38 EDT 2001


"Chris McMillan" <christopherjmcmillan at eaton.com> writes:

> Hello all!
> 
> I'm trying to write a script that will open a file, delete the first line,
> and then save the file with the same name.  Can someone please point me in
> the right direction?  Thanks!


Umpf. I really like python, but sometimes other solutions are less
cumbersome. With bash it's a one-liner like:

  for x in *; do y=`basename $x`.new; tail +1 $x >$y; mv $y $x; done

Sorry, couldn't read from your message if you are on Microsoft where
a bash script usually does not help a lot.

  Harald Kirsch

-- 
----------------+------------------------------------------------------
Harald Kirsch   | kirschh at lionbioscience.com | "How old is the epsilon?"
LION bioscience | +49 6221 4038 172          |        -- Paul Erdös
       *** Please do not send me copies of your posts. ***



More information about the Python-list mailing list