Skip to content
Advertisement

How to change a word in a file with linux shell script

I have a text file which have lots of lines I have a line in it which is: MyCar on

how can I turn my car off?

Advertisement

Answer

You could use sed:

sed -i 's/MyCar on/MyCar off/' path/to/file
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement