I need to search the first 50 lines of every file in a directory and its subdirectories.
This will do the recursive part, but how do I limit to just the first 50 lines of each file?
grep -r "matching string here" .
Some of these files are huge, and I only want them to match in the first 50 lines. I'm trying to speed up the process by not searching megabytes of binary data in some files.