Sed is a command line tool used for pattern recognition and substitution in one or more text files. Sed is also called a stream editor. It is a very powerful tool which when mastered can help you in near-magic modifications to your files – all with just a few tap of your fingers.
One of the frequent uses of Sed is in text substitution. For example, if you want to change all the occurrences of the word “train” with the word “car” in your file “myfile.txt”, you can do it easily using sed as follows.