QuestionQ12

Essential Commands

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

  • A grep '/$' foo
  • B grep '/#' foo
  • C grep -v '/$' foo
  • D grep -v '/#' foo
Explanation

The pattern /$ matches a slash at the end of a line, and grep -v reverses the selection so that only nonmatching lines are printed.

Community Discussion

No comments yet. Be the first to start the discussion!