Please help me with exercise 4 , Thanx

I am having problem with the first question of exercise 4… Am I supposed to use sed command for changing the LARRY to LAERTES but it is not working out…Plz help

Hello :slight_smile:

May I ask you to post here content of scene-3.txt file?

1 Like

Hamlet: Act 1, Scene 3

A room in Polonius’ house.


My necessaries are embark’d: farewell:
And, sister, as the winds give benefit
And convoy is assistant, do not sleep,
But let me hear from you.

Do you doubt that?

For Hamlet and the trifling of his favour,
Hold it a fashion and a toy in blood,
A violet in the youth of primy nature,
Forward, not permanent, sweet, not lasting,
The perfume and suppliance of a minute; No more.

No more but so?

Hm, I thought that it might be a problem with tests, I have misunderstood the question, sorry.

According to the instructions you don’t really have to use sed command, you can simply change all occurrences of LARRY to LAERTES by hand.

But if you want to, here is how to do this using sed:

Make sure that you are in the right directory
$ pwd

Use sed to find and replace
$ sed -i -e 's/LARRY/LAERTES/g' scene-3.txt 

-i - make changes in place
-e - we are going to define expression
's/LARRY/LAERTES/g - substitue (s) all (g) occurrences of LARRY with LAERTES

Please note that you have to close the file and open it again to see the changes. Or you can use cat command :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.