Q: How do I replace text in file using sed?
 

A: The below replaces text string "test" with the new string "test-new" in file called "text.txt".

# sed 's/test/test-new/g' text.txt

See also Replace text in file using perl.