Hi,
I am new to Perl, I was wondering if anyone have sample code to sort multiple columns based on positional data file(the data is not delimited by any characters). I need to sort based on Col1, Col2 and Col5 and create the output file. I would appreciate if someone can help me out with this.
TIA, Prabal
===============
This is the input file:
Col1 Col2 Col3 Col4 Col5 Col6 ======================================================== D1001 SNAM1 1 101 XYZ1234 21.11 D1001 SNAM1 1 102 XYZ2234 22.12 D1002 SNAM2 1 201 PQR2234 12.12 D1002 SNAM2 2 202 PQR2234 32.12 D1002 SNAM2 3 203 PQR2234 52.12 D1002 SNAM2 4 204 PQR2234 37.12 D1001 SNAM1 2 103 XYZ1234 22.12 D1003 SNAM3 1 301 ABC1234 22.12 D1002 SNAM2 5 205 PQR2234 37.12 D1001 SNAM1 4 104 XYZ1234 22.12
This is the output file I am expecting:
D1001 SNAM1 1 101 XYZ1234 21.11 D1001 SNAM1 2 103 XYZ1234 22.12 D1001 SNAM1 4 104 XYZ1234 22.12 D1001 SNAM1 1 102 XYZ2234 22.12 D1002 SNAM2 1 201 PQR2234 12.12 D1002 SNAM2 2 202 PQR2234 32.12 D1002 SNAM2 3 203 PQR2234 52.12 D1002 SNAM2 4 204 PQR2234 37.12 D1002 SNAM2 5 205 PQR2234 37.12 D1003 SNAM3 1 301 ABC1234 22.12
Code tags added by GrandFather
In reply to Sample Sort Code by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |