sed command FAQ: How can I use the Unix/Linux sed command to edit (modify) files in place?
The short answer is that you just need to use the -i or --in-place sed arguments, as shown in the sed man page:
edit files in place (makes backup if extension supplied)
Then, if you have a file named 'hello.txt' with contents like this:
this is a test
you can then run a sed command like this to modify that file: