EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 37


SIMULATION -

Search a String -

Find out all the columns that contains the string seismic within /usr/share/dict/words, then copy all these columns to /root/lines.tx in original order, there is no blank line, all columns must be the accurate copy of the original columns.

Show Answer
Correct Answer:

The task is to search for the string 'seismic' in the file /usr/share/dict/words and copy all lines containing this string into /root/lines.txt in the original order without any blank lines. The correct command to achieve this is: grep seismic /usr/share/dict/words > /root/lines.txt. This command utilizes grep to search for 'seismic' within the specified file and redirects the output to /root/lines.txt, preserving the order and ensuring no blank lines are included.

Discussion

4 comments
Sign in to comment
STFN2019
Sep 18, 2021

grep seismic /usr/share/dict/words > /root/lines.tx cat /root/lines.tx

KimoHasNoBalls
Aug 22, 2022

Do they want "rows" or "columns" ? No idea how to find and redirect columns but rows is easy

noobmaster96
Nov 25, 2021

cat /usr/share/dict/words | grep seismic > /lines.tx

14_aman
May 31, 2022

IF I do run this command : grep seismic -w /usr/share/dict/words > /root/lines.tx . please explain . Am I saying right ?