How to replace a string in diff. files with incremental values. For example-
In 1st file I need '1'
In 2nd file I need '2'
In 3rd file I need '3'.. so on
Please help
How to replace a string in diff. files with incremental valu
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 3
- Joined: Thu Sep 16, 2010 5:56 pm
-
- Posts: 3
- Joined: Thu Sep 16, 2010 5:56 pm
Thanks for the reply, What you were saying is within a same file. But I need incremental value in different files.
ConEdison wrote:we have a string which repeats in each and every record. So we have to write a script in ksh which finds that string on each line and replaces it with a new string(incremental value) for a set every four records.
CODE:
dallastexasabc12345tx
dentonabc12345tx
houstoabc12345tx
sanfraabc12345tx
oklahamaabc12345oh
irvingfrabc12345tx
mcaurtabc12345tx
kingkotabc12345tx
abc12345 is the repeating string in each and every record, we have to replace it with an incremental value say 12345678 in first four records and then with 12345679 in the next four records and so on.
John Galt
Sales Consultant
Albany, New York