HI Experts,
I have a "wierd" question on the sorting of a file and saving the content in another.
Say I have the source file source.txt with a content such as below
S22555 D25833967 25833967
O22555 D25833967 0644413200
IBBUY_8564030O3 D25833909 0644370500
T22555 D25833967 0644413200
PBBUY_8564030O3 D25833909 0644370500
P22555 D25833967 0644413200
PBBUY_8564030O3 D25833909 0644370500
I22555 D25833967 0644413200
When I sort on the numerical values in the text using sort -0 destfile.txt +19 -28 sourcefile.txt i am getting the answer something like this
TBBUY_8564030O3 D25833909 0644370500
TBBUY_8564030O3 D25833909 0644370500
TBBUY_8564030O3 D25833909 0644370500
TBBUY_8564030O3 D25833909 0644370500
TBBUY_8564030O3 D25833909 0644370500
TBBUY_8564030O3 D25833909 0644370500
TBBUY_8564030O3 D25833909 0644370500
meaning all T's are coming as a bunch all s's are coming as a bunch and all the other I's and P's. But all I want is something like below
SBBUY_8564030O3 D25833909 25833909
OBBUY_8564030O3 D25833909 0644370500
TBBUY_8564030O3 D25833909 0644370500
PBBUY_8564030O3 D25833909 0644370500
IBBUY_8564030O3 D25833909 0644370500
S22555 D25833967 25833967
O22555 D25833967 0644413200
T22555 D25833967 0644413200
P22555 D25833967 0644413200
I22555 D25833967 0644413200
I want all the fileds to be sorted on the positions 19 to 28 and then put in the order sotpi.
Can you please help me getting this?
Thanks in advance,
Adi
Start Free Trial