A few days ago I was trying to achieve something with grep (which is usually not a big problem) and a large file with one word per line (a dictionary). I wanted to grep out all the lines which contained words with three or less characters. And after wasting some time I decided to write a note to myself:
If you have a file like this:
yyy@xxx:~$ cat bla
a
ab
abc
abcd
and use grep like this
yyy@xxx:~$ grep "^.{1,3}$" bla
then you don’t get any output.
It also won’t help if you add -e. You will have to add -E in order to activate extended regular expressions, or you can call egrep(which is deprecated).
yyy@xxx:~$ grep -E "^.{1,3}$" bla
a
ab
abc