Sounds like you want sed. For example,
sed 's/foo/bar/' < big-input-file > big-output-file
should replace the first occurrence of foo
by bar
in each line of big-input-file
, writing the results to big-output-file
.
Bonus answer: I just learned about paste, which seems to be exactly what you want for your bonus question.