I have a text file that each line of it ,is a record of data with a specific structure. I want to read it Line by Line, in a specific Line for example in Line 1000 Change a data Like:
sara , 1991 , Zakizadeh , Student , Tehran
Eli , 2005 , Lord , teacher , London
Elias , 1875 , Lion , farmer , Berlin
Change to:
sara , 1991 , Zakizadeh , Student , Tehran
Eli , 2005 , Lord , teacher , London
Elias , 1875 , Star, farmer , Berlin ****
I can find the number of line and and can change the data and update the same line, but there are some problems:
- maybe the amount of characters in a line after update be more than a line and it be continued in another line!
- if I want to prevent top problem , I can to put limitation for each data for example Name : 20 Char , Birth date: 4 char ,.... but if its data be less than this amount it can make Redundancy in such a large file about more than 6000 lines.
What is your solution?