I am trying to achieve following output from an input file.
Input File: record lenght 213, fixed
in position 8, I have program names
in position 177, i have timestamp data
I have sorted the file with respect to program name, timestamp
If I consider program name and timestamp as an unique group, I want first two occerences of each group in output file. If the group occurs only once, then also that group needs to be in output file.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Huh? The output you show does NOT match the rules you gave. In fact, your output is indentical to your input, except that you removed these records for some unknown reason:
I am thinking of unique group which is a combination of Programname and timestamp. for example
for program ABA012B - there are 3 groups, for ABA015B - 2 groups and for ABA019B - 1 group
first group is
.....ABA012B.................2004-10-26-14.52.22.743163.....
.....ABA012B.................2004-10-26-14.52.22.743163.....
.....ABA012B.................2004-10-26-14.52.22.743163.....
second group is
.....ABA012B.................2005-07-24-15.25.08.639561.....
.....ABA012B.................2005-07-24-15.25.08.639561.....
.....ABA012B.................2005-07-24-15.25.08.639561.....
third combination is
.....ABA012B.................2005-08-22-16.30.08.640333.....
.....ABA012B.................2005-08-22-16.30.08.640333.....
.....ABA012B.................2005-08-22-16.30.08.640333.....
4th group is
.....ABA015B.................2003-03-06-14.44.19.347273.....
.....ABA015B.................2003-03-06-14.44.19.347273.....
5th group is
.....ABA015B.................2007-09-07-19.53.11.345000.....
.....ABA015B.................2007-09-07-19.53.11.345000.....
6th group is
.....ABA019B.................2004-10-26-14.52.24.215062.....
.....ABA019B.................2004-10-26-14.52.24.215062.....
.....ABA019B.................2004-10-26-14.52.24.215062.....
.....ABA019B.................2004-10-26-14.52.24.215062.....
In my input file, there are millions of records, which comprises several groups like mentioned above and each group may contain 1 or more records. For each program, there can be n number of groups.
I tried to extract first 2 groups of each program.
like for program ABA012B, I want to extract only
first group is
.....ABA012B.................2004-10-26-14.52.22.743163.....
.....ABA012B.................2004-10-26-14.52.22.743163.....
.....ABA012B.................2004-10-26-14.52.22.743163.....
second group
.....ABA012B.................2005-07-24-15.25.08.639561.....
.....ABA012B.................2005-07-24-15.25.08.639561.....
.....ABA012B.................2005-07-24-15.25.08.639561.....
For program ABA015B, I want to capture
4th group
.....ABA015B.................2003-03-06-14.44.19.347273.....
.....ABA015B.................2003-03-06-14.44.19.347273.....
5th group
.....ABA015B.................2007-09-07-19.53.11.345000.....
.....ABA015B.................2007-09-07-19.53.11.345000.....
For program ABA019B, I want to capture below, since it is having only 1 group.
6th group
.....ABA019B.................2004-10-26-14.52.24.215062.....
.....ABA019B.................2004-10-26-14.52.24.215062.....
.....ABA019B.................2004-10-26-14.52.24.215062.....
.....ABA019B.................2004-10-26-14.52.24.215062.....
I have tried to follow your instructions by mapping the positions, as I have a different layout this time. Now the file length is 279. Timestamp is at 243 position and program names is same at 8. While building the file, I have sorted Program name on ascending and timestamp on descending manner. But still not able to get latest 2 timestamps of each program. In fact I am getting more occurences of each group.
Please ignore my last message, I am getting the expected result by mapping the instructions of Skolusu.The program name actually starts from 18. As the new functions of DFSORT is quite interesting, I want to download the same from the link given by Frank, but it leads to a FTP link which is not working for me. Is there any way I can download the PDF.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
pcsingh_2000,
The DFSORT FTP site is accessible to everyone. Unless you work at a shop which blocks FTP sites you shouldn't have a problem downloading the documents.