If you're using C you could probably do something with fgetc (scan for 10/13 and count them, so you know which line you're on).
As for replacing, the only way I know is to rewrite the file, although I've never done much with file operations.
If you allready know the line to replace, the pseudocode might go something like:
open file
open newfile
copy contents of file to newfile until you reach the line to replace
scan line for word, store file pointer value at the START of the word
move file pointer backwards to start of line again
copy the line to newfile UP TO the word position
output the new word
scan to the next value 32 (the space between the word you want to skip output of and the next one)
continue copying til EOF
erase file, rename newfile
Obviously, easier said than done.
[edit]
Pseudocode corrected - i missed the bit about you wanting to look for a word
[/edit]