Please help me with exercise 4 , Thanx


#1

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

https://www.codecademy.com/courses/learn-git/lessons/git-backtracking/exercises/more-git-add?action=resume_content_item


#2

Hello :slight_smile:

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


#3

sure…
Hamlet: Act 1, Scene 3

A room in Polonius’ house.

Enter LARRY and OPHELIA

LARRY
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.

OPHELIA
Do you doubt that?

LARRY
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.

OPHELIA
No more but so?


#4

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
/home/ccuser/workspace/hamlet-prince-of-denmark

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:


#5

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