Quote:
Originally Posted by new2ksh
...
your code is Code:
sort -k2,10 -k32,33
...
|
That isn't my code ! My code had 28, which you changed to 32 and expected it to work. Take a look at the series of responses above.
Quote:
...
i want to see the record in alphabetical order like below
23333333330001695 000001039OLF-AA030600020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330000111 000001039ODL-SP002000020091112
Can you please send me the right code both for the position 2:10 and 32:33
...
|
Since you haven't mentioned specifically, I shall assume that you want characters 2:10 sorted ascending and then characters 32:33 sorted ascending as well.
Code:
$
$ cat file1.dat
21111111110001343 000001004OLF-AA029100020091112
21111111110000060 000001004ODL-CH001000020091112
24444444440001416 000001045OLF-AA011800020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000111 000001039ODL-SP002000020091112
23333333330000060 000001039ODL-CH001000020091112
22222222220000780 000001013OLF-AA006500020091112
$
$ sort -k 1.2,1.10 -k 2.14,2.15 file1.dat
21111111110001343 000001004OLF-AA029100020091112
21111111110000060 000001004ODL-CH001000020091112
22222222220000780 000001013OLF-AA006500020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330000111 000001039ODL-SP002000020091112
24444444440001416 000001045OLF-AA011800020091112
$
$