Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Increment value in text file

$
0
0
Hi Guys,

I am new to shell programing, I have a csv file which has 50k records and I have got the requirement to increment the value in second column after each 5000 records.

for example below


A,B,C,D //Header
1,1,London,UK
1,1,Manchester,UK
1,1,Glasgow,UK
.
.
.
1,1,Newyork,USA

I am expecting final output like


A,B,C,D //Header
1,1,London,UK
.
//after 5k record
.
1,2,Manchester,UK
.
//after 5k records
.
1,3,Glasgow,UK
.
.
.
.
1,10,Newyork,USA

Viewing all articles
Browse latest Browse all 16232