03-05-2007
6,
0
Join Date: Mar 2007
Last Activity: 6 March 2007, 8:58 AM EST
Posts: 6
Thanks Given: 0
Thanked 0 Times in 0 Posts
Pipelines
Now before this thread gets closed, please be aware this is not classwork or homework, I am trying to learn unix by myself, and have come stuck below. So it is a pointless to close this thread, as I am trying to improve my unix by asking advice from people. That is what I assume a forum is for!
I am trying to work out how to complete this question, and after learning a bit more unix. i have written an answer to it. Can anyone check to see if it is correct and what improvements need to be made?
Write a pipeline that updates the content of a file (a file of your choice) by replacing all matches of the word ‘and' with the symbol ‘&' and by replacing the end of each line with the user login name. If the command completes successfully it should print ‘YES', otherwise it should print ‘NO'.
cat text.txt | sed -e s/and/$USER/g -e s/$/”&”/g | cat -> text.txt
&& echo yes || echo no
thanks
vish