I'm trying to find a way to scan a folder on my OSX system for all files containing a specific string of text(#SomeTag") in specific line(hashtag in first line). Just to clarify, I'm looking for text within the file, not in the file name.
I tried ag, fzf and also the combination but can't make it work how i want.
I would like to search in files with fzf that has some hashtags in specific line. For example:
#TagOne #TagTwo searchpattern
This would search for searchpattern only in files that have the #TagOne #TagTwo in first line.
Update: So far i came up whit this solution which works but its far from optimal but it works exactly how i want. The script takes 1-3 arguments after finding the files i can full text fuzzy search in the content of all found files.
#!/bin/sh
if [ "$#" == 1 ]; then
ag -Ril $1 ./Evernote | xargs ag --nobreak --nonumbers --noheading . | fzf
fi
if [ "$#" == 2 ]; then
ag -Ril $1 ./Evernote | xargs ag -il $2 | xargs ag --nobreak --nonumbers --noheading . | fzf
fi
if [ "$#" == 3 ]; then
ag -Ril $1 ./Evernote | xargs ag -il $2 | xargs ag -il $3 | xargs ag --nobreak --nonumbers --noheading . | fzf
fi