You can use the stream editor command sed to filter and transform text. For example, to substitute the word Sky with the word Cloud in facts.txt, you can run the command:
elliot@ubuntu-linux:~$ sed 's/Sky/Cloud/' facts.txt
Apples are red.
Grapes are green.
Bananas are yellow.
Cherries are red.
Cloud is high.
Earth is round.
Linux is awesome!
Cherries are red.
Cherries are red.
Cherries are red.
Grass is green.
Swimming is a sport.
As you can see in the output, the word Sky is replaced with Cloud. However, the file facts.txt is not edited. To overwrite (edit) the file, you can use the -i option:
elliot@ubuntu-linux:~$ sed -i 's/Sky/Cloud/' facts.txt
elliot@ubuntu-linux:~$ cat facts.txt
Apples are red.
Grapes are green.
Bananas are yellow.
Cherries are red.
Cloud is high.
Earth is round.
Linux is awesome!
Cherries are red.
Cherries are red.
Cherries are red.
Grass is green.
Swimming is a sport.
As you can see, the change is reflected in the file.