Assuming you can use the code with the asorti function, as per post #2:
Code:
BEGIN{ FS = ","; getline } Code:
BEGIN{ FS = ","; getline } |
For the original input file it works perfectly.
However my real file is slight different... I thought it will be easy for me to modify it but it occur much more difficult. here is a sample Code:
# text text text Code:
12/7/10 00:00,gg2a,15791,3372,4018,5,1.8840170106E10,3.043735864E9,1.5796434242E10,1.7081492E7, Code:
BEGIN{ FS = ","; getline } |
Yes, things are a bit more complicate here. First a question: based on what criteria do you merge lines? How many variants of the "gg" field may occur?
|
merge line criteria is:
Code:
12/7/10 00:00,gg2a There 2 types of lines but each contain 6 columns separated by comma: eg. type 1: Code:
12/7/10 00:00,gg2b,4961,92,31190,4, Code:
12/7/10 00:00,gg2a,1.8840170106E10,3.043735864E9,1.5796434242E10,1.7081492E7, |
Here is a working example based on the input data in post #17:
Code:
BEGIN { FS = "," } I have some doubt about the sorting process, anyway. First, if you want to sort by date (for example from the oldest to the most recent) you should have a date format that can be naturally sorted in an alphanumeric sense. For example: Code:
10/07/12 00:00 |
Works perfect! Thank you.
There is one my big mistake which makes to you not clear situation. The flag gg should always be "gg[one digit 0-9][one a-z]. I have written that: Quote:
Sorry for that. |
Corrected my posts accordingly! :)
|
All times are GMT -5. The time now is 09:53 AM. |