I am new to linux, I have one 200 lines in a file. In that file I need to replace the specific word eg: existing word: foo New word : bar I read some blogs...i understood it can be done with sed. But I do not know how to do that with a shell script
sed 's/foo/bar/' /path to a file I need to write a script, I do not know how to give the file as an input or should I store in a variable and change the specific word.
The script should change the specific word as well as the file name eg: Input File name: cat home.txt (word to be replaced -->cat) OutPut Filename: Dog home.txt(Cat should be replaced with Dog)
Kindly help!
fooas a substring of a word that should not be modified, for examplefood,foobarormy-foo?sed 's/foo/bar/' < "file"orsed 's/foo/bar' "file".