I would like to use sed
to replaced a string in place. I've tried two ways:
sed -i 's/string_catcher/new_string/g' <file_name>
This results in an error because it doesn't treat the argument properly. This is the source of my information.
Then, I figured I could just write to file instead:
sed 's/string_catcher/new_string/g' <file_name> > <file_name>
As a work around, I considered just writing it to a new file and copying it back to the old file by overwriting. But this won't work because the file is huge. It takes several minutes to just open in vim.
However, this results in the file just being empty. why these no work? solutions? Thanks.
I'm on OSX Darwin Kernel 14.4.