[Tutor] how to sort the file out
lina
lina.lastname at gmail.com
Wed Sep 7 08:13:05 CEST 2011
For file 1,
1 C1
2 O1
3 C2
4 C3
5 H3
This one is much more like dictionary,
; nr atom cgnr charge mass
1 C1 1 0.062 15.0350
2 O1 1 -0.139 15.9994
3 C2 1 0.064 12.0110
4 C3 1 -0.001 12.0110
5 H3 1 0.014 1.0080
which was from field one and filed 2, namely the atom column,
while for file 2:
12 H3
13 C1
14 O1
15 C2
16 C3
I want to be arranged like:
13 C1
14 O1
15 C2
16 C3
12 H3
only sort field 2 based on the dictionary, to match the sequence of
C1, O1, C2, C3, H3.
Thanks again,
I want to arranged the field 3 according to match the dictionary (file
1) sequence.
On Wed, Sep 7, 2011 at 1:52 PM, <bodsda at googlemail.com> wrote:
> I'm also slightly confused. Why does file one start at 1, but file 2 starts at 3. Why not just duplicate file2?
>
> Bodsda
> Sent from my BlackBerry® wireless device
>
> -----Original Message-----
> From: lina <lina.lastname at gmail.com>
> Sender: tutor-bounces+bodsda=googlemail.com at python.org
> Date: Wed, 7 Sep 2011 12:46:37
> To: tutor<Tutor at python.org>
> Subject: [Tutor] how to sort the file out
>
> HI, I have two files, one is reference file, another is waiting for adjust one,
>
> File 1:
>
> 1 C1
> 2 O1
> 3 C2
> 4 C3
> 5 H3
> 6 C7
> 7 O2
> 8 H22
> 9 C6
> 10 H61
> 11 C5
> 12 H5
> 13 C4
> 14 C8
> 15 C9
> 16 C10
> 17 O3
> 18 C11
> 19 C12
> 20 O4
> 21 C13
> 22 C14
> 23 C15
> 24 C20
> 25 H20
> 26 C16
> 27 H16
> 28 C17
> 29 H17
> 30 C18
> 31 O6
> 32 H62
> 33 C19
> 34 O5
> 35 C21
>
> File 2:
> 3 H16
> 4 H5
> 6 H61
> 7 H17
> 9 H20
> 12 H3
> 13 C1
> 14 O1
> 15 C2
> 16 C3
> 17 C4
> 18 C5
> 19 C6
> 20 C7
> 21 C8
> 22 C9
> 23 C10
> 24 O3
> 25 C11
> 26 C12
> 27 O4
> 28 C13
> 29 C14
> 30 C15
> 31 C20
> 32 C19
> 33 C18
> 34 C17
> 35 C16
> 36 O5
> 37 C21
> 38 O6
> 39 H62
> 40 O2
> 41 H22
>
> I wish the field 2 from file 2 arranged the same sequence as the field
> 2 of file 1.
>
> Thanks for any suggestions,
>
> I drove my minds into nuts already, three hours passed and I still
> failed to achieve this.
>
> --
> Best Regards,
>
> lina
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
Best Regards,
lina
More information about the Tutor
mailing list