Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to use sed to simulate grep -v?

Answer:

There are two methods to simulate grep -v (print out line(s) if not match) in sed.

# sed -n '/regexp/!p'

or

# sed '/regexp/d'

  1. Count the number of matching lines from grep
  2. How to grep for tab character(s) in Linux
  3. Only show filenames in grep command
  4. How to simulate curl using wget command?
  5. How to grep a string in a binary file?

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>