Linux String Substitute (sed)

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

Hi @peterwhite

Sorry for inconvenience, your answer is marked as SUCCESS and issue is fixed now.

Please note that you were supposed to delete the entire line containing the word copyright but you only deleted the word itself, hence your answer was marked as failed.

Please notice the spaces before and after copyright (sed ‘/ copyright /d’) in your command that made it not to match the pattern hence changes were not made correctly.

1 Like

Hi @Inderpreet. No worries, I’m happy to help improve the platform. Thanks for taking care of this.

2 Likes

Thank you Inderpreet. I should have been little more wary.
Have a great day ahead!
Swaroop

Completed the Task with below

ssh clint@stbkp01
sudo su -
ls -al( to check if Nautilus.xml file is present in root)
cat /root/nautilus.xml (to view how many instances of old String value are there)
sed -i ‘s/String/Submarine/g’ /root/nautilus.xml
cat /root/nautilus.xml (all instances are changed to new string )

task is completed.

For troubleshooting/solution video refer below. These videos are made just to help the community!

2 Likes

Thanks Peter. Those are valuable inputs learned something today. I was unable to switch to root figured it out after multiple failures.

Hi I have the same problem do that like video and check them by cat command but in conform faild!!!

its fake video don’t follow it try your own. google it you will find the solution.

I believe I did the right things but the task failed saying the statement below:

Make sure to replace all the occurrences of ‘or’ to ‘them’ in ‘/home/BSD_REPLACE.txt’ on stapp01