1

How would I display the lines that do not contain certain letters? This is what I have already tried unsuccessfully to show the lines that do not consist of an a or b:

egrep *[^ab]* filename
1
  • You have this answer in one of the comments on a previous answer to another question of yours. You should read them! Also see man grep; it can learn you a lot. Sep 29, 2013 at 6:38

1 Answer 1

2

Just use invert matching:

grep -v "[ab]" filename

Source: man page for grep

1
  • Don't forget to quote the pattern to grep. If the current directory happens to have the two files named a and b, the command will turn into grep -v a b filename, which does something different than intended. So: grep -v '[ab]' filename
    – geirha
    Sep 29, 2013 at 10:38

Not the answer you're looking for? Browse other questions tagged .