Does any one know how to find and replace text in a file. it can be implimented into a bash file. i would like to find the line and the output the text to it the file can only be opened with the root sudo account.
Basic example of
sed usage using this as
one two three two four two five
foo in that file:
sed -i 's/foo/two/g' test.txt
What that means:
sedis the name of the command, you'll find lots of tutorials (e.g.) and other documentation online, in addition to
-imeans edit a file in place.
sindicates substitute first term for the second, the
g(global) indicates for all instances in each line (not just the first). Always remember to 'enclose' this.