$ sed 's/snow/rain/' forests.txt
sed stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace".
Let's look at the expression
s: stands for "substitution". it is always used when using
sed for substitution.
snow: the search string, the text to find.
rain: the replacement string, the text to add in place.
In this case,
sed searches forests.txt for the word "snow" and replaces it with "rain." Importantly, the above command will only replace the first instance of "snow" on a line.
$ sed 's/snow/rain/g' forests.txt
The above command uses the
g expression, meaning "global". Here
sed searches forests.txt for the word "snow" and replaces it with "rain", globally. All instances of "snow" on a line will be turned to "rain".