exam questions

Exam LX0-103 All Questions

View all questions & answers for the LX0-103 exam

Exam LX0-103 topic 3 question 30 discussion

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

Which of the following commands replaces each occurrence of 'bob' in the file letter with 'Bob' and writes the result to the file newletter?

  • A. sed '/bob/Bob' letter > newletter
  • B. sed s/bob/Bob/ letter < newletter
  • C. sed 's/bob/Bob' letter > newletter
  • D. sed 's/bob/Bob/g' letter > newletter
  • E. sed 's/bob, Bob/' letter > newletter
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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 a breakdown of what each part of the command does: sed is a command-line utility used for text processing and manipulation. 's/bob/Bob/g' is a command that tells sed to substitute (or replace) all occurrences of the string "bob" in the input with the string "Bob". The g at the end of the command tells sed to perform the substitution globally, i.e., on every occurrence in the input. letter is the name of the input file to be processed by sed. > is a redirection operator that tells the shell to redirect the output of the command to a new file, rather than to the terminal window. newletter is the name of the new file where the modified contents of "letter" will be saved. So, the overall effect of the command is to search for all occurrences of "bob" in the file "letter", replace them with "Bob", and save the modified contents to a new file named "newletter". This command can be useful for making bulk changes to a file, such as correcting the capitalization of a name or correcting a misspelling.
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