exam questions

Exam LX0-103 All Questions

View all questions & answers for the LX0-103 exam

Exam LX0-103 topic 3 question 38 discussion

Actual exam question from CompTIA's LX0-103
Question #: 38
Topic #: 3
[All LX0-103 Questions]

Which of the following commands will reduce all consecutive spaces down to a single space?

  • A. tr '\s' ' ' < a.txt > b.txt
  • B. tr -c ' ' < a.txt > b.txt
  • C. tr -d ' ' < a.txt > b.txt
  • D. tr -r ' ' '\n' < a.txt > b.txt
  • E. tr -s ' ' < a.txt > b.txt
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
linux_admin
2 years, 2 months ago
Here's how it works: tr is a command-line utility that translates or deletes characters in a stream of data. -s is an option for tr that squeezes multiple consecutive occurrences of a character into a single occurrence. ' ' is the character that you want to squeeze, which in this case is a space. < a.txt is a shell redirection that takes the contents of the file a.txt as input to the tr command. > b.txt is a shell redirection that sends the output of the tr command to the file b.txt. So, the overall effect of the command is to read the contents of the file a.txt, replace all consecutive spaces with a single space, and write the modified contents to the file b.txt.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago