ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 273 - XK0-005 discussion

Report
Export

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?

A.
tr '(A-Z}' '{a-z}' < testfile > uppercase
Answers
A.
tr '(A-Z}' '{a-z}' < testfile > uppercase
B.
echo testfile | tr '[Z-A]' '[z-a]' < testfile > uppercase
Answers
B.
echo testfile | tr '[Z-A]' '[z-a]' < testfile > uppercase
C.
cat testfile | tr '{z-a)' '{Z-A}' < testfile > uppercase
Answers
C.
cat testfile | tr '{z-a)' '{Z-A}' < testfile > uppercase
D.
tr '[a-z]' '[A-Z]' < testfile > uppercase
Answers
D.
tr '[a-z]' '[A-Z]' < testfile > uppercase
Suggested answer: D

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 file12.

asked 02/10/2024
Mark Hughes
30 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first