The tr command is used to translate, squeeze, or delete characters from a file or a stream. The -d option is used to delete characters that appear in the first operand. The \r and \n are escape sequences that represent the carriage return and the line feed characters, respectively. The CR-LF pair is the standard line ending for Windows text files, while the LF character is the standard line ending for Linux text files. Therefore, the command tr –d ‘\r’ < userlist.txt > newlist.txt will delete all the CR characters from the userlist.txt file and redirect the output to the newlist.txt file, effectively converting the line endings from Windows to Linux format. The other commands are incorrect because they either use the wrong syntax, the wrong operands, or the wrong redirection. References:
LPI 101-500 Exam Objectives, Topic 103.7, Weight 4
LPI Learning Materials, Chapter 3.7, Basic Scripting
Web Search Results, 1
QUESTIONNO: 54
When in Normal mode invi, which character can be used to begin a reverse search of the text?
A.?
B./
C.F
D.r
Answer: A
In vi, the ? character can be used to begin a reverse search of the text. This means that the search will start from the current cursor position and move backwards towards the beginning of the file. The search pattern can be any regular expression that matches the desired text. To repeat the search, the user can press n for the previous match or N for the next match. The / character can be used to begin a forward search of the text, which means that the search will start from the current cursor position and move forwards towards the end of the file. The F and r characters are not used for searching, but for other commands in vi. The F command is used to move the cursor to a previous occurrence of a specified character in the current line. The r command is used to replace the character under the cursor with another character. References:
LPI 101-500 Exam Objectives, Topic 103.8, Weight 4
LPI Learning Materials, Chapter 3.8, Advanced Scripting
Web Search Results,