On Tue, 30 Apr 2019 14:08:10 -0500, Ron Thomas wrote:
>Here is the actual production files data ,
>
>102,3522850,15,FF,9
>202,3522850,15,FF,9
>102016,3522850,15,FF,9
>104152,3522850,15,FF,7
>104152,3522850,15,FF,9
>104760,3521499,15,FF,9
>104760,3521499,15,FF,9
>106735,3507181,15,FF,9
>989898989,3507181,15,FF,9
>989898989,3507181,15,FF,9
> 
OK.  Since I don't know DFSORT, here's a non-DFSORT, more procedural, approach:

#! /bin/sh
{ cat <<Does-not-occur
102,3522850,15,FF,9
202,3522850,15,FF,9
102016,3522850,15,FF,9
104152,3522850,15,FF,7
104152,3522850,15,FF,9
104760,3521499,15,FF,9
104760,3521499,15,FF,9
106735,3507181,15,FF,9
989898989,3507181,15,FF,9
989898989,3507181,15,FF,9
Does-not-occur
} |
awk 'BEGIN {
    FS=","
    Prev = "Never a key." }

$1!=Prev { N = 0 }

  { N += 1
    Prev = $1
    print( N","$0 ) }'

... and its output:
1,102,3522850,15,FF,9
1,202,3522850,15,FF,9
1,102016,3522850,15,FF,9
1,104152,3522850,15,FF,7
2,104152,3522850,15,FF,9
1,104760,3521499,15,FF,9
2,104760,3521499,15,FF,9
1,106735,3507181,15,FF,9
1,989898989,3507181,15,FF,9
2,989898989,3507181,15,FF,9

There are many tools in the box.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to