The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-01-2008
ganapati's Avatar
ganapati ganapati is offline
Registered User
  
 

Join Date: Jul 2006
Location: Mysore
Posts: 125
Question Sorting 2 positional fields

Hi Friends,

I've a large datafile, I've to sort the entire records of this file based on the positions. For ex:

ccc112IVEAGH VETERINARY SERVICES
cca110SHOOTER PROPERTY SERVICES
bbb111JUNIOR GOLF ACADEMY LIMITED
aaa110AULD PROPERTIES T/A R&J AULD
ccb111LISBURN FUELS
aac112P & MRS C LE ROUX T/A CURVES
bbc112ENNISKILLEN LAWN TENNIS CLUB
aab111BALLYDOWN KIDS ACADEMY LTD
bba110ROYAL ULSTER AGRICULTURAL SO


The above records have to be sorted from the position 1-3 and 4-6(This is only example, position may differ). I know how to sort records for one field using "sort" command. But positionwise and for two fields I dont know.
The expected result should be:

aaa110AULD PROPERTIES T/A R&J AULD
aab111BALLYDOWN KIDS ACADEMY LTD
aac112P & MRS C LE ROUX T/A CURVES
bba110ROYAL ULSTER AGRICULTURAL SO
bbb111JUNIOR GOLF ACADEMY LIMITED
bbc112ENNISKILLEN LAWN TENNIS CLUB
cca110SHOOTER PROPERTY SERVICES
ccb111LISBURN FUELS
ccc112IVEAGH VETERINARY SERVICES


Please help me

Thanks in advance / Mysore Ganapati