Quote:
Originally Posted by
kshari8888
Thanks.
But the file is big one having 5000 records. I want to change only 154 th
char where the file is having 306 chars.
I'm lost. If you have a file with 5000 records, how can the file contain only 306 characters???
Are you saying that each record in your file has a fixed length of 306 characters (or bytes) and that you want to change the character in character position 154 from
1 to
0 if the "word" before that position is one of the three strings you specified in post #1?
Note that the sample input you provided does not have a total of 306 characters, does not have 306 character lines, does not have fixed length lines (records), and does not have the
1 that you want to change in a fixed position.
Are you just looking for a single character
1 following one of your three specified strings? Or, does it have to be a
1 followed by a <space> (so multi-digit numbers starting with a
1 as the 1st digit would not changed to have a leading
0)?
Do the varying numbers of <space> characters between fields in your lines have to be maintained? Or can strings of multiple adjacent <space>s be coalesced into a single <space>?
Is the
1 you want to change always the 4th field and the strings you are looking for always the 3rd field in a line (as in your sample input)?