Re Insu 123
Re Insu 456
Allcede 123
Allcede 123
Allcede 123
Allcede 123
Allcede 123
Encompa 569
Encompa 458
I want to replace the 1st occurence of "Allcede 123" by "Allcede 777",2nd by "Allcede 666" ,3rd occurence by "Allcede 555",4th occurence by "Allcede 444" and 5th occurence by "Allcede 222"".All rest records should be same.
So my output File should be
Code:
Re Insu 123
Re Insu 456
Allcede 777
Allcede 666
Allcede 555
Allcede 444
Allcede 222
Encompa 569
Encompa 458
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Will your input have random occurrences of 'Allcede 123' , counting more than 5? If yes, what would you like to see in the output, especially for the 6th or later.
Something like...
Code:
--some data
--some data
Allcede 123
Allcede 123
--some data
--some data
Allcede 123
--again some more data
Allcede 123
Allcede 123
Allcede 123
Allcede 123
Will your input have random occurrences of 'Allcede 123' , counting more than 5? If yes, what would you like to see in the output, especially for the 6th or later.
No.Input file is exactly same as i have given in earlier post.
But i have confusion here after adding sequence number for every occurrence of "Allcede 123" .How to replace it by "Allcede 777","Allcede 666","Allcede 555","Allcede 444","Allcede 222"
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
If sequence number is one, you put the first value, if sequence number is two, you put the second, if sequence number is three, you put the third, and so on.