EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 93


SIMULATION -

Download the document from ftp://instructor.example.com/pub/testfile, find all lines containing [abcde] and redirect to /MNT/answer document, then rearrange the order according the original content.

Show Answer
Correct Answer:

To accomplish the task, follow these steps: First, download the file from the specified FTP server. Then, use the 'grep' command to search for lines containing any of the characters 'a', 'b', 'c', 'd', 'e' and redirect the output to the specified file location. The 'grep' command with a character class is used to match any single character specified within the brackets. Finally, ensure the file system path exists before redirecting the output. The correct command sequence should be as follows: wget ftp://instructor.example.com/pub/testfile, mkdir -p /MNT, grep [abcde] testfile > /MNT/answer.

Discussion

2 comments
Sign in to comment
jahute27
Apr 22, 2021

# wget ftp://instructor.example.com/pub/testfile # mkdir -p /MNT/answer # grep ‘abcde’ testfile > /MNT/answer

cloudyhr
Jan 3, 2022

mkdir will create a folder, to create a file we should use the touch command touch /mnt/answer

Kindolos1
Sep 10, 2022

redirect will create the file automatically

kenkct
Mar 14, 2022

sudo su mkdir -p /MNT wget ftp://instructor.example.com/pub/testfile grep 'abcde' testfile > /MNT/answer cat /MNT/answer (to verify)