DEV Community

Mike Whitaker
Mike Whitaker

Posted on • Updated on

Shell command options you didn't know you needed #2

(another in an occasional series)

grep -m <matches>

One of the many handy options to grep (there'll be quite a few in this series), the -m option controls how many matches are displayed for each file grep scans.

For (hypothetical) example:

grep -m 1 '^sub' *.pm # find the first sub definition in each file

Top comments (1)

Collapse
 
raagpc profile image
raag pc

Good, grep is really handy