XK0-005 · Question #667
XK0-005 Question #667: Real Exam Question with Answer & Explanation
The correct answer is D: tr '[a-z]' '[A-Z]' < testfile > uppercase. This command will use the tr tool to translate all lowercase letters in the testfile to uppercase letters and write the output to the uppercase file. The first argument [a-z]' specifies the set of characters to be replaced, and the second argument [A-Z]' specifies the set of char
Question
A file called testfile has both uppercase and lowercase letters: $ cat testfile ABCDEfgH IJKLmnoPQ abcdefgH ijklLMNopq A Linux administrator is tasked with converting testfile into all uppercase and writing it to a new file with the name uppercase. Which of the following commands will achieve this task?
Options
- Atr '(A-Z}' '{a-z}' < testfile > uppercase
- Becho testfile | tr "[Z-A]" "[z-a]" < testfile > uppercase
- Ccat testfile | tr '{z-a)' '{Z-A}' < testfile > uppercase
- Dtr '[a-z]' '[A-Z]' < testfile > uppercase
Explanation
This command will use the tr tool to translate all lowercase letters in the testfile to uppercase letters and write the output to the uppercase file. The first argument [a-z]' specifies the set of characters to be replaced, and the second argument [A-Z]' specifies the set of characters to replace with. The <' symbol redirects the input from the testfile, and the >' symbol redirects the output to the uppercase file.
Topics
Community Discussion
No community discussion yet for this question.