i want to sort the org_no column ie position 2:10 in ascending eg 111111111 then 222222222 then 333333333 etc.
also i want to sort the member_type column position 28:33 in asc eg:
for the line 4 above after sorting i should get like this
This i want in .KSH script, after i do the sort for the above 2 columns from the input FILE1.DAT i should get the out FILE2.DAT like below
thanks for the help
Last edited by zaxxon; 11-06-2009 at 07:38 AM..
Reason: use code tags please, ty
...
also i want to sort the member_type column position 28:33 in asc eg:
for the line 4 above after sorting i should get like this
...
Your output is wrong. If the data is to be sorted by column positions 28 through 33 in ascending order, then for the rows 4 through 6, it would be this:
you are right, that was my mistake the position 28 through 33 should be in descending order.
Quote:
Originally Posted by durden_tyler
Your output is wrong. If the data is to be sorted by column positions 28 through 33 in ascending order, then for the rows 4 through 6, it would be this:
In any case, the sort command can be used here:
tyler_durden
---------- Post updated at 09:02 AM ---------- Previous update was at 07:05 AM ----------
Can someone please answer my query.
i like to sort the position 2:10 in ascending and position 32:33 in descending and not 28:33 as i mention earlier in my post.
Outfie FILE2.DAT should be like this
21111111110001343 000001004OLF-AA029100020091112
22222222220000780 000001013OLF-AA006500020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330000111 000001039ODL-SP002000020091112
24444444440001416 000001045OLF-AA011800020091112
Quote:
Originally Posted by new2ksh
you are right, that was my mistake the position 28 through 33 should be in descending order.
...
i like to sort the position 2:10 in ascending and position 32:33 in descending and not 28:33 as i mention earlier in my post.
Outfie FILE2.DAT should be like this
21111111110001343 000001004OLF-AA029100020091112
22222222220000780 000001013OLF-AA006500020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330000111 000001039ODL-SP002000020091112
24444444440001416 000001045OLF-AA011800020091112
The requirement still doesn't match the output.
The requirement says 2:10 ascending and then 32:33 descending.
The output shows 2:10 ascending and then 32:33 ascending.
what matters to me is the OUTFILE FILE2.DAT
I like to have the data in FILE2.DAT is
21111111110001343 000001004OLF-AA029100020091112
22222222220000780 000001013OLF-AA006500020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330000111 000001039ODL-SP002000020091112
24444444440001416 000001045OLF-AA011800020091112
your code is
working find but the position 32:33 is in not in alphabetical order. eg:
23333333330000111 000001039ODL-SP002000020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330001695 000001039OLF-AA030600020091112
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
Thanks again.
Quote:
Originally Posted by durden_tyler
The requirement still doesn't match the output.
The requirement says 2:10 ascending and then 32:33 descending.
The output shows 2:10 ascending and then 32:33 ascending.
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.
tyler_durden
Last edited by durden_tyler; 11-06-2009 at 11:41 AM..
Hi,
i had a data block (coming from pipe from other codes) as:
H YF_CO.dat 77164 11/17/2013 04:00:02 731374590.96 1 1 731374590.96 76586 77164 578 2988 Y
H YF_CO.dat 77164 11/17/2013 04:00:07 731374590.96 1 4 731374590.96 76586 77164 578 2988 Y
H YF_CO.dat 77178 ... (5 Replies)
cat file1.txt
field1 "user1":
field2:"data-cde"
field3:"data-pqr"
field4:"data-mno"
field1 "user1":
field2:"data-dcb"
field3:"data-mxz"
field4:"data-zul"
field1 "user2":
field2:"data-cqz"
field3:"data-xoq"
field4:"data-pos"
Now i need to have the date like below.
i have just... (7 Replies)
I have a column of numbers in the following format:
1.722e-05
2.018e-05
2.548e-05
2.747e-05
7.897e-05
4.016e-05
4.613e-05
4.613e-05
5.151e-05
5.151e-05
5.151e-05
6.1e-05
6.254e-05
7.04e-05
7.12e-05
7.12e-05 (6 Replies)
Hi there
I have to enhance my current file looping to ensure the oldest file being processed first.
current command:
for FILENAME in `find $MY_DIRECTORY -follow -type f`
I manage to get command for order by date modified descending, just can't get the ascending order. Please help
for... (3 Replies)
Hy guys. My English is not so good, sorry for any mistakes.
I'm a bigginer in C, and I have a problem. I want to sort ascending n strings, but I can't read the strings. Here is what I've done so far:
//sort ascending n strings
#include <stdio.h>
int main()
{
int n,i,j;
char a;
... (8 Replies)
HI everyone,
I am trying to use the unix sort command to get a list of numbers sorted in ascending order but having trouble in getting it to work.
An example of this issue would be when i am trying to sort the following three
number each on a different line "1" , "2" and "116" the sort command... (3 Replies)
Dear All,
I have below attached file in which i have many nos, i want the last ascending order nos. The brief description is given below.
File
315
381
432
315
381
432
315
381
432
315
381
432
315
381
432 (6 Replies)