DEV Community

Mike Whitaker
Mike Whitaker

Posted on • Edited on

6 1

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

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more