How do you use grep to find terms that are n characters long?

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-05-22T07:11:39Z Indexed on 2010/05/22 7:20 UTC
Read the original article Hit count: 135

Filed under:
|

I'm using grep to filter the Mac OS X dictionary words file (by default located at /usr/share/dict/words).

I want to use grep to retrieve all words four characters long. How do I do this?

My best guess for how to do this was:

grep [:alpha:]{4} words

But that returns zero results.

© Stack Overflow or respective owner

Related posts about grep

Related posts about regex