101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 44


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

Show Answer
Correct Answer: C

The regular expression that correctly transforms the input stream into the desired output stream is s/txt$/bak.txt/. This expression searches for the string 'txt' only at the end of the lines and replaces it with 'bak.txt'. The other options either do not match the pattern only at the end of the line, or they use incorrect syntax, making them unsuitable for producing the intended output.

Discussion

17 comments
Sign in to comment
shyamiteOption: C
Feb 21, 2020

correct \/ In my opinion the correct option is s / txt $ / bak.txt /

cast7omadrid1Option: C
Feb 6, 2020

In my opinion the correct option is s / txt $ / bak.txt /

RalfScholzeOption: C
Feb 24, 2021

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.

ThuhaibOption: C
Mar 19, 2021

C is the Correct Answer

salienteOption: C
Feb 13, 2022

/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

cloudbasedOption: C
May 28, 2022

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.

Rini_GiannenzoOption: C
Nov 14, 2020

C check todoist

anhcqOption: C
Nov 14, 2021

sed s/txt$/bak.txt/ <<TXT > txt1.txt > atxt.txt > txtB.txt > TXT answer is C

serlanOption: C
Jan 11, 2022

answer is C

nedoexOption: C
Jan 23, 2022

aswer must be C

w3rrOption: C
Feb 17, 2022

answer is C

basic88Option: B
Oct 9, 2020

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/,

CuriousLinuxCatOption: B
Jul 24, 2021

B makes the most sense to me. Adding the $ just unnecessarily complicates things.

NedyarOption: B
Oct 20, 2021

text inside file: txt1.txt atxt.txt txtB.txt cat file | sed 's/txt/bak.txt/' bak.txt1.txt abak.txt.txt bak.txtB.txt I am doing something wrong?

gonzalocoOption: C
Apr 19, 2022

C 100%

blk_542Option: C
Nov 17, 2022

Correct is C

NinymoOption: C
Mar 24, 2024

Answer: C