EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 107


SIMULATION -

Find all lines in the file /usr/share/dict/words that contain the string seismic. Put a copy of all these lines in their original order in the file /root/wordlist. /root/wordlist should contain no empty lines and all lines must be exact copies of the original lines in /usr/share/dict/words.

Show Answer
Correct Answer:

To find all lines in the file /usr/share/dict/words that contain the string 'seismic', and to copy these lines into the file /root/wordlist without including any empty lines, you can use the following command: grep 'seismic' /usr/share/dict/words > /root/wordlist. This command uses 'grep' to search for lines containing 'seismic' in /usr/share/dict/words and redirects the output to /root/wordlist, maintaining the original order and ensuring that all lines are exact copies of the original lines and that no empty lines are included.

Discussion

2 comments
Sign in to comment
STFN2019
Sep 28, 2021

[root@uranium ~]# grep seismic /usr/share/dict/words > /root/wordlist [root@uranium ~]# cat /root/wordlist

cloudyhr
Jan 8, 2022

grep seismic /usr/share/dict/words >> /root/wordlist

2022G
Apr 14, 2022

can we do it like this? #cd /usr/share/dict #grep seismic cp /root/wordlist