101-500 question 237 discussion

View all LPIC-1 System Administrator Exam 101, Part 1 of 2, here
back to lpi forum

Question 237

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

  • A. s/^.txt/.bak/
  • B. s/txt/bak.txt/
  • C. s/txt$/bak.txt/
  • D. s/^txt$/.bak^/
  • E. s/[.txt]/.bak$1/
Answer:

B

User Votes:
A
50%
B 3 votes
50%
C 3 votes
50%
D
50%
E 1 votes
50%
Discussions
0 / 1000
daittarn2
2 months ago

B is wrong:
Replaces every occurrence of txt with bak.txt.

txt1.txt → bak.txt1.bak.txt

C Is the correct one txt$ means that it replaces only the word that has the "txt" at the end