Hi,
I have a large file with blocks of text starting with an "l ". I have to find the begining (strncmp), read the rest of the block and write the output file with the same info with an addition or two. As an example, if input looks like this:
l compfl
ttlFlags for where we are/were in the interview
n10Base
n01not yet qualified; c=c145'1'
n01Qualified; c=c145'2'
The output would look like this:
l compfl;c=c145u$ $
ttlFlags for where we are/were in the interview
n10Base
n01not yet qualified; c=c145'1'
n01Qualified; c=c145'2'
There are other formats of the block. And there is always a blank line between blocks in the input.
My question is, how do I read a line and after finding "l ", read some more input until the the next block then write the output with the results getting back and forth with ease? Do I write the output first and alter it or just work a line at a time writting the output as I go? Also, any help with finding the arbitrary number within the string and changing it to an integer would be of great help. (The number can be 3 or 4 digits long)
Thanks for your help. (Sorry about the semi-long post)
-Tyler
I have a large file with blocks of text starting with an "l ". I have to find the begining (strncmp), read the rest of the block and write the output file with the same info with an addition or two. As an example, if input looks like this:
l compfl
ttlFlags for where we are/were in the interview
n10Base
n01not yet qualified; c=c145'1'
n01Qualified; c=c145'2'
The output would look like this:
l compfl;c=c145u$ $
ttlFlags for where we are/were in the interview
n10Base
n01not yet qualified; c=c145'1'
n01Qualified; c=c145'2'
There are other formats of the block. And there is always a blank line between blocks in the input.
My question is, how do I read a line and after finding "l ", read some more input until the the next block then write the output with the results getting back and forth with ease? Do I write the output first and alter it or just work a line at a time writting the output as I go? Also, any help with finding the arbitrary number within the string and changing it to an integer would be of great help. (The number can be 3 or 4 digits long)
Thanks for your help. (Sorry about the semi-long post)
-Tyler