Given the following input stream: txt1.txt atxt.txt txtB.txt Which of the following regular expressions turns this input stream into the following output stream? txt1.bak.txt atxt.bak.txt txtB.bak.txt
C because $ will change the only "txt" at the end of the line. If there is no $ symbol the command will change the first part of the name of the first file too.
/var/root # cat teste | sed s/txt$/bak.txt/
txt1.bak.txt
atxt.bak.txt
txtb.bak.txt
/var/root # cat teste | sed s/txt/bak.txt/
bak.txt1.txt
abak.txt.txt
bak.txtb.txt
C is the right
s/txt$/bak.txt/ replaces the string txt with bak.txt at the end of the line. Globally is nonsense, since there is only one “txt at the end of the line” in any line.
Memorize B for your test. After passing the test, forget B and realize that the answer C is the correct one. Life is tough.
I think b is the correct answer. The only option that is missing is the g at the end.
/txt/ wil search for exactly that word, and will change it to /bak.txt/,
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
shyamite
Highly Voted 4 years, 4 months agocast7omadrid1
Highly Voted 4 years, 5 months agoNinymo
Most Recent 3 months, 3 weeks agoblk_542
1 year, 8 months agocloudbased
2 years, 1 month agogonzaloco
2 years, 2 months agow3rr
2 years, 5 months agosaliente
2 years, 5 months agonedoex
2 years, 5 months agoserlan
2 years, 6 months agoanhcq
2 years, 8 months agoNedyar
2 years, 9 months agoCuriousLinuxCat
2 years, 11 months agoThuhaib
3 years, 3 months agoRalfScholze
3 years, 4 months agoRini_Giannenzo
3 years, 8 months agobasic88
3 years, 9 months ago