[Tutor] File Access

Christian Wyglendowski Christian.Wyglendowski at greenville.edu
Wed Apr 7 12:05:15 EDT 2004


> -----Original Message-----
> 
> 
> Hi folks,
> 
> I need to go to the last line of a file and then to the start 
> of a delimited section of that line, such as
> 
> $ cat file.txt
> var1|var2|var3|var4|var5|var6|var7
> var1|var2|var3|var4|var5|var6
> var1|var2|var3|var4|var5|var6
> 
> What I want to do is goto the last line in the imaginary 
> file.txt above and extract var3 for example.

You might want to check out the following recipe at the python cookbook.
It is kind of a basic tail written in python.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/276149

Christian
http://www.dowski.com



More information about the Tutor mailing list