Skip to content

Instantly share code, notes, and snippets.

@dzc34
Created June 7, 2019 05:54
Show Gist options
  • Save dzc34/6f97f136a03f579790fff0205df417dd to your computer and use it in GitHub Desktop.
Save dzc34/6f97f136a03f579790fff0205df417dd to your computer and use it in GitHub Desktop.
Shell - Chercher un texte dans des fichiers
# rechercher l'expression "texte_a_trouver"
# dans tous les fichiers du dossier courant et sous-dossiers
grep -R texte_a_trouver .
# pour afficher uniquement le nom des fichiers
# ----> 1 fichier contenant l'exression plusieurs fois, sera listé plusieurs fois
grep -Rl texte_a_trouver .
# pour afficher uniquement le nom des fichiers (sans doublons)
grep -R texte_a_trouver . | cut -d ':' -f1 | sort -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment