101-400 Exam QuestionsBrowse all questions from this exam

101-400 Exam - Question 59


Which grep command will print only the lines that do not end with a / in the file foo?

Show Answer
Correct Answer: C

To print only the lines that do not end with a / in the file foo, you should use the grep command with the -v option. The -v option inverts the matching, so it will display lines that do not match the pattern '/$'. The pattern '/$' matches lines that end with a /. Therefore, 'grep -v "/$" foo' is the correct command to achieve this.

Discussion

1 comment
Sign in to comment
DuboisNicolasDuclairOption: C
Oct 21, 2023

The `grep` command that will print only the lines that do not end with a `/` in the file `foo` is: C. `grep -v '/$' foo` The `-v` option in `grep` inverts the matching, so it will display lines that do not end with a `/`.