{"thread":{"id":"63748","subject":"How to restrict command “git grep” to the first search result per file?","startedAt":"2025-07-06T11:29:12Z","lastAt":"2025-07-08T05:35:52Z","messageCount":5,"participants":["Markus Elfring","Andreas Schwab","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"521360","messageId":"fb74577d-f7b8-4fde-ab5a-5283e70b8258@web.de","threadId":"63748","inReplyTo":null,"subject":"How to restrict command “git grep” to the first search result per file?","fromName":"Markus Elfring","fromEmail":"markus.elfring@web.de","sentAt":"2025-07-06T11:28:47Z","receivedAt":"2025-07-06T11:29:12Z","isPatch":false,"sender":{"key":"markus.elfring@web.de","avatar":null},"body":"Hello,\n\nFile contents can be searched also by the means of the program call “git grep”.\nWould you become interested to find specified items only once in each file\n(instead of multiple times)?\n\nRegards,\nMarkus\n"},{"id":"521361","messageId":"87wm8lo89w.fsf@igel.home","threadId":"63748","inReplyTo":"fb74577d-f7b8-4fde-ab5a-5283e70b8258@web.de","subject":"Re: How to restrict command “git grep” to the first search result per file?","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2025-07-06T11:42:19Z","receivedAt":"2025-07-06T11:42:38Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Jul 06 2025, Markus Elfring wrote:\n\n> File contents can be searched also by the means of the program call “git grep”.\n> Would you become interested to find specified items only once in each file\n> (instead of multiple times)?\n\nDoes \"git grep -l\" suit your needs?\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"521362","messageId":"b1753222-0043-4b1d-acd4-9afac0197c65@web.de","threadId":"63748","inReplyTo":"87wm8lo89w.fsf@igel.home","subject":"Re: How to restrict command “git grep” to the first search result per file?","fromName":"Markus Elfring","fromEmail":"markus.elfring@web.de","sentAt":"2025-07-06T12:20:06Z","receivedAt":"2025-07-06T12:20:16Z","isPatch":false,"sender":{"key":"markus.elfring@web.de","avatar":null},"body":">> Would you become interested to find specified items only once in each file\n>> (instead of multiple times)?\n> \n> Does \"git grep -l\" suit your needs?\nI imagine that it can occasionally matter see a bit more context for a search result\nbesides a file name.\n\nRegards,\nMarkus\n"},{"id":"521364","messageId":"83b8fd7c-622a-4041-a825-89fe743b6c97@gmail.com","threadId":"63748","inReplyTo":"fb74577d-f7b8-4fde-ab5a-5283e70b8258@web.de","subject":"Re: How to restrict command “git grep” to the first search result per file?","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-06T13:27:11Z","receivedAt":"2025-07-06T13:27:21Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Markus\n\nOn 06/07/2025 12:28, Markus Elfring wrote:\n> File contents can be searched also by the means of the program call “git grep”.\n> Would you become interested to find specified items only once in each file\n> (instead of multiple times)?\n\nLooking at the man page for git grep there is a --max-count option which \nwill limit the number of matches per file.\n\nThanks\n\nPhillip\n"},{"id":"521502","messageId":"a4b7226e-8069-485e-85c1-432047b847e3@web.de","threadId":"63748","inReplyTo":"87wm8lo89w.fsf@igel.home","subject":"Re: How to restrict command “git grep” to the first search result per file?","fromName":"Markus Elfring","fromEmail":"markus.elfring@web.de","sentAt":"2025-07-08T05:30:28Z","receivedAt":"2025-07-08T05:35:52Z","isPatch":false,"sender":{"key":"markus.elfring@web.de","avatar":null},"body":"> Does \"git grep -l\" suit your needs?\n\nIs it possible to determine such information also by a corresponding function\n(instead of the mentioned program call interface)?\n\nWould you occasionally like to transfer file details for search results\nby other application programming interfaces?\n\nRegards,\nMarkus\n"}]}