LPIC-1 Exam 101 v5 (Linux Administrator) — Question 100
Which of the following commands changes all CR-LF line breaks in the text file userlist.txt to Linux standard LF line breaks and stores the result in newlist.txt?
Answer options
- A. tr -d '\r' < userlist.txt > newlist.txt
- B. tr -c '\n\r' ''userlist.txt
- C. tr '\r\n' ''newlist.txt
- D. tr '\r' '\n' userlist.txt newlist.txt
- E. tr -s '/^M/^J/' userlist.txt newlist.txt
Correct answer: A
Explanation
The correct answer is A, as it effectively removes the carriage return character ('
') from the file, leaving only the line feed ('
') which is the standard for Linux. Options B and C are incorrectly formatted and do not perform the necessary operation, while D incorrectly attempts to specify both input and output files in the wrong format. Option E uses a non-standard syntax that is not valid for the tr command.