Hi,
I have an output file (.txt) from a computational chemistry program. At some point in this file, following an unknown number of iterative steps, the following table will be found:
Comparison of initial and final structures :
--------------------------------------------------------------------------------
Parameter Initial value Final value Difference Units Percent
--------------------------------------------------------------------------------
Volume
a
b
c
alpha
beta
gamma
1 x
1 y
1 z
2 x
2 y
2 z
3 x
3 y
3 z
4 x
4 y
4 z
5 x
5 y
5 z
6 x
6 y
6 z
7 x
7 y
7 z
8 x
8 y
8 z
--------------------------------------------------------------------------------
Is there an easy method for:
1. numbering the lines in the file?
2. finding this table
3. copying the table exactly
4. extracting each row (or rather rows 1-6) into separate files
I know how to open and read a file, [i.e. with open('output.txt', 'r') as f] but am a little bemused by the rest.
I ask as, although this is a very easy 'point and click using a mouse' task for one file, but that would be very tedious and time consuming to do for the several hundred files I actually have.
Any help would be appreciated, although please be patient as I am not fully up to speed with programming yet - particularly with regard to formatting.
Cheers