Search Header Logo

Mastering the grep Command

Authored by Leyla Zeynallı-Hüseynzadə

Computers

12th Grade

Used 3+ times

Mastering the grep Command
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the basic syntax of the grep command?

grep pattern [file...] [options]

grep [file...] pattern

grep [options] pattern [file...]

grep [options] [file...] pattern

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you use grep to search for a specific string in a file?

grep -search string filename

grep string > filename

grep 'string' -o filename

grep "string" filename

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the -i option do in grep?

The -i option makes the search case-insensitive.

The -i option limits the search to a specific file type.

The -i option includes only specific lines in the output.

The -i option displays line numbers in the output.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain how to use grep with regular expressions.

Use grep with the command 'grep -F pattern filename' for exact match.

Use grep with the command 'grep -E "pattern" filename' for regex search.

Execute 'grep -i pattern filename' to ignore case sensitivity.

Run 'grep --regex pattern filename' to search with regex.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the -v option in grep?

The -v option in grep counts the number of matches.

The -v option in grep displays only matching lines.

The -v option in grep excludes matching lines.

The -v option in grep shows the version of grep.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you search for a pattern in multiple files using grep?

Use 'grep pattern -f file.txt'

Use 'grep pattern --include=*.txt'

Use 'grep pattern --exclude=*.log'

Use 'grep pattern filename*' or 'grep -r pattern directory/'.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the -r option do when using grep?

The -r option limits the search to the current directory only.

The -r option displays the line numbers of matches.

The -r option ignores case sensitivity in the search.

The -r option makes grep search recursively through directories.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?