MokiNex
MokiNex

Reputation: 879

How to stop grep after matching

In Windows, I would have done a search for finding a folders name using findsr Similarly, I want to get a specific folder using grep

In windows, I'm using svnlook tree -t [repos_path] | findstr (13\.9\.[0-9]+\/)

In Ec2 Maiche (Linux) svnlook tree /var/www/svn/ILS | grep -Eo '(13\.9\.[0-9]+\/)' and I got the repos that I need

my problem is the grep line in Linux doesn't want to stop (exit) it's still running.

enter image description here

how could I stop it after matching?

Upvotes: 0

Views: 1144

Answers (2)

Walter A
Walter A

Reputation: 20002

After ^Z the svnlook is paused. You kan kill (^C) the program, send it to the background (bg) or continue (fg).
When you want to interrupt you can use ^C or start the grep with a -m option.

Upvotes: 0

choroba
choroba

Reputation: 241868

You can specify the -m: maximal number of counts. After the specified number of matching lines, grep will stop.

Upvotes: 3

Related Questions