LPIC-1 Exam 101 v5 (Linux Administrator) — Question 1

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

Answer options

Correct answer: C

Explanation

The correct answer is C because it matches 'txt' at the end of each filename and replaces it with '.bak.txt', resulting in the desired output. Option A incorrectly targets the beginning of the string, B replaces 'txt' but does not ensure it appears at the end, D does not match correctly, and E attempts to replace characters rather than the entire 'txt' substring.