find . ! -name . -prune -type f -exec cat {} + |
grep mystring |
LC_ALL=C sort -u
Ou:
find . ! -name . -prune -type f -exec cat {} + | awk '
/mystring/ && !seen[$0]++'
Com o GNU grep :
LC_ALL=C grep -hr --exclude-dir='?*' mystring | LC_ALL=C sort -u
Ou com zsh e GNU grep :
grep -h mystring ./*(D.) | LC_ALL=C sort -u
Para pesquisar em arquivos em subdiretórios, recursivamente:
find . -type f -exec cat {} + |
grep mystring |
LC_ALL=C sort -u
Ou:
find . -type f -exec cat {} + | awk '
/mystring/ && !seen[$0]++'
Com o GNU grep :
grep -hr mystring | LC_ALL=C sort -u
Note que todas essas soluções também olham dentro de arquivos ocultos (e arquivos dentro de diretórios ocultos), mas não em arquivos não-regulares e não seguem links simbólicos (a menos que você use alguma versão antiga do GNU grep com -r ).