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

fleetfootmike

Mike Whitaker

Posted on March 5, 2020

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

💖 💪 🙅 🚩
fleetfootmike
Mike Whitaker

Posted on March 5, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related