Linux String Substitute (sed)

Hello Team,

Even myself faced the same issue .

Hi @Inderpreet, @kodekloud-support3,

Please review my task submission. I feel that the task description was poorly worded, and that I executed the task correctly based on literal interpretation of the task description (“Delete all lines containing word distribution” - so I respected word boundaries) but, based on the failure, I assume the verification method was based on string evaluation (I left instances of Redistribution because the task did not state to delete all lines containing the string distribution, which can exist as a “substring” - there’s no such thing as a “subword” as far as I’m aware). I actually debated whether I should respect word boundaries in my sed command because I was concerned about how the task would be verified…

It would be easy to say that I misinterpreted the word “word”, and should have thought “string”, but there’s a difference between the two, especially when the task description uses “containing word” in the instructions for BSD_DELETE.txt and “occurrence of string” in the instructions for BSD_REPLACE.txt - that implies that these two words/strings should be treated differently…

Thanks,
Peter

1 Like

Same here. I too left the redistribution words in the file, but failed. Was your exercise marked as passed?

1 Like

No, it’s still marked as failed. I assume someone from KodeKloud will respond to this post and state whether my solution is acceptable and either update their verification code to match the wording or change the wording of the exercise to reflect that they want all lines with the string “distribution” to be deleted to avoid confusion for others in the future…

I got this result :Make sure to replace all the occurences of or to their in /home/BSD_REPLACE.txt on stapp03. But I think i did’t right.
Please advise

Hi San,
I get permission denied while running same commands.
Please check and comment.


Thanks,
Swaroop

@Inderpreet @vijin.palazhi @rahulsoni


where i am going wrong?
Thanks,
Swaroop

Hi @swaroopcs88,

Check the permissions on the directory you’re attempting to write to…

-Peter


I don’t have execute permission on the root directory.

You’re looking at the files in the directory - not the actual directory’s permissions…

Try “ls -ld .”

You should see that you don’t have write permissions to that directory as user “banner”.

image

@swaroopcs88, correct - that should, hopefully, tell you what you need. I’ve been dropping hints, as opposed to actual solutions, since I don’t recall the exact forum policy with respect to that. However, I’d imagine that KodeKloud doesn’t want us posting test solutions in the forums.

Given the tests that you’ve already completed to reach this exercise, you should have already written or edited files that are only writeable by root…

1 Like

Thank you! I understand your points. Sure, I will complete the task with the hints given here and in the question.
Thanks,
Swaroop

You’re quite welcome, I’m happy to help!

Peter

Hi @peterwhite @Darshan1893 @chawki

Thank you for your feedback and reporting these issues. We have modified this task a little and marked it as Pending for you guys. Please give it an another try.

@SuAdmin Can you please share your email ID.

1 Like

Thanks @Inderpreet. The new task description is much better (changing “to” to “with”, in "all occurrences of ‘and’ to ‘for’, would be a slight improvement) but it looks like the task validation logic is incorrect…

Please let me know if I misinterpreted the new instructions in any way…

Thanks!
Peter

sudo sed ‘/ copyright /d’` /home/BSD.txt > /home/BSD_DELETE.txt

not sure, if the space before and after copyright caused the task to get failed.

@Inderpreet @vijin.palazhi @rahulsoni @peterwhite
Please check and comment.
@peterwhite Thanks for your valuable inputs, I got to know, I was supposed to log in as a root user. Then try to update the file, that’s correct?

I should have validated my results against the requirements of the question.
Which I din’t do in this question, feeling bad for me. thanks
Swaroop

Hi @Inderpreet, I think I did everything correctly and still it got failed. Request you to review my task once and let me know the details.

You’re quite welcome, Swaroop, that is correct.