in reply to Problem with deleting the first n characters on a line

You're not resetting your file position before writing back into FOUND (and even if you did, I don't think this code would do what you expect because the new string you write out is shorter than the original).

The quick 'n' easy way: open up a second file for output. Loop through the entire input file, changing lines as necessary before printing them to the output file. At the end, remove the original and rename your output file to the original's filename.

  • Comment on Re: Problem with deleting the first n characters on a line