Advertisement

08.28.2008 at 07:32PM PDT, ID: 23687762 | Points: 250
[x]
Attachment Details

Problem in UNIX Sort Script [URGENT]

Asked by ADiRaju-B in HP-UX Unix, Unix Operating Systems, Unix Systems Programming

Tags:

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,
AdiStart Free Trial
 
Keywords: Problem in UNIX Sort Script [URGENT]
 
Loading Advertisement...
 
[+][-]09.02.2008 at 05:57AM PDT, ID: 22366782

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.07.2008 at 03:45PM PDT, ID: 22413244

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 07:31AM PDT, ID: 22417722

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 08:34AM PDT, ID: 22418420

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 08:36AM PDT, ID: 22418440

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628