I’m searching a directory recursively using grep with the following arguments hoping to only return the first match. Unfortunately, it returns more than one — in-fact two the last time I looked. It seems like I have too many arguments, especially without getting the desired outcome. :-/

# grep -o -a -m 1 -h -r "Pulsanti Operietur" /path/to/directory

returns:

Pulsanti Operietur
Pulsanti Operietur

Maybe grep isn’t the best way to do this? You tell me, thanks very much.

7 Answers
7

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *