nerdexam
Red_Hat

EX200 · Question #11

11. Find String Find all lines containing the string "ng" in the file /usr/share/xml/iso-codes/iso_639_3.xml. Save copies of all these lines to /root/list in the root directory. /root/list must not…

The grep command filters lines containing a specific string from a file, and its output is redirected to another file.

Submitted by devops_kid· Apr 18, 2026Understand and Use Essential Tools

Question

  1. Find String Find all lines containing the string "ng" in the file /usr/share/xml/iso-codes/iso_639_3.xml. Save copies of all these lines to /root/list in the root directory. /root/list must not contain empty lines, and all lines must be exact copies of the original lines in /usr/share/xml/iso-codes/iso_639_3.xml. Correct Answer: See the below explanation Explanation Explanation/Reference: Solution: [root@node1 ~]# grep ng /usr/share/xml/iso-codes/iso_639_3.xml [root@node1 ~]# grep ng /usr/share/xml/iso-codes/iso_639_3.xml > /root/list # Verification [root@node1 ~]# cat /root/list

Explanation

The grep command filters lines containing a specific string from a file, and its output is redirected to another file.

Concept tested. Filtering text with grep and output redirection

Reference. https://www.gnu.org/software/grep/manual/grep.html

Topics

#grep#text search#file redirection#command line utilities

Community Discussion

No community discussion yet for this question.

Full EX200 Practice