[RESOLVED] sort command not having desired effect
Posted: 2011/11/11 15:03:56
I cannot get the sort command in Centos5.7 to replicate a sort previously done on SCO Openserver 5.0.5.
I have transferred everything from SCO box to Centos5.7 box without much problem but 1 application requires the sorting of an external text file prior to processing. The file is large with each record having many fields but the problem is simple to explain.
One of the fields I must sort on has either numbers or alpha characters (no spaces) but both are quoted with double quotes ie "12345" or "ABCD". The file cannot be modified (eg removing quotes) as the following process requires them.
I need to use the field to get the records in alphanumeric order but with smaller number before larger numbers eg:
IN-FILE
"51393"
"51393"
"5172"
"5172"
"2703"
"2703"
"2703"
"5172"
"2703"
"CASH"
"CASH"
"62175"
"5172"
"62175"
"CASH"
"CASH"
"62175"
"62175"
OUT-FILE
"2703"
"2703"
"2703"
"2703"
"5172"
"5172"
"5172"
"5172"
"51393"
"51393"
"62175"
"62175"
"62175"
"62175"
"CASH"
"CASH"
"CASH"
"CASH"
SCO sorts the records correctly but nothing I do with Centos5.7 works.
Can anyone assist even if it means using a different language sort on Centos5.7 as at the moment I am having to continue running the old SCO server just for this task.
I have transferred everything from SCO box to Centos5.7 box without much problem but 1 application requires the sorting of an external text file prior to processing. The file is large with each record having many fields but the problem is simple to explain.
One of the fields I must sort on has either numbers or alpha characters (no spaces) but both are quoted with double quotes ie "12345" or "ABCD". The file cannot be modified (eg removing quotes) as the following process requires them.
I need to use the field to get the records in alphanumeric order but with smaller number before larger numbers eg:
IN-FILE
"51393"
"51393"
"5172"
"5172"
"2703"
"2703"
"2703"
"5172"
"2703"
"CASH"
"CASH"
"62175"
"5172"
"62175"
"CASH"
"CASH"
"62175"
"62175"
OUT-FILE
"2703"
"2703"
"2703"
"2703"
"5172"
"5172"
"5172"
"5172"
"51393"
"51393"
"62175"
"62175"
"62175"
"62175"
"CASH"
"CASH"
"CASH"
"CASH"
SCO sorts the records correctly but nothing I do with Centos5.7 works.
Can anyone assist even if it means using a different language sort on Centos5.7 as at the moment I am having to continue running the old SCO server just for this task.