Exercise 4


#1

Hello, is there a command for changing Larry to Laertes or do you need to do it mannually?


#2

You can do it manually, but there is a command (assuming you are in the directory which contains the file):

sed -i 's/Larry/Laertes/g' scene-7.txt

you enter this in the command line, just like the git command.i am not sure it is scene-7.txt, if it is not, replace scene-7.txt wit the desired file (scene-3.txt?). sed is not related to git, and is not covered in this course. quick break down of the command:
sed is a stream editor for filtering and transforming text
the -i options allows you to read and write to the same file
`s/Larry/Leartes/g' is the tricky bit, the s is from substitute, then Larry is what you want to replace, Leartes is what you want to replace it with, g indicates global (which means it will alter all occasions, not only the first) and scene-7.txt is the file you want to execute the substitution on.

you can enter:
man sed
in the command line to get the manual pages of sed