Grep sur trois fichier
togian
-
togian -
togian -
/bin/sh
printf "\n1. recherche pronom\n"
read choix;
if [ $choix = "1" ]; then
printf "\tle pronom ?"
read le
cat fichier-1 | grep -w $le
cat fichier-2 | grep -w $le
cat fichier-3 | grep -w $le
fi
le fichier-1 contient je, tu. le fichier-2 il, nous.
le fichier-3 vous, ils
viola comment faire pour que mon script quand il trouve
le pronom (je) s'arrete et ne vas pas chercher dans les autres fichier
merci reponse
printf "\n1. recherche pronom\n"
read choix;
if [ $choix = "1" ]; then
printf "\tle pronom ?"
read le
cat fichier-1 | grep -w $le
cat fichier-2 | grep -w $le
cat fichier-3 | grep -w $le
fi
le fichier-1 contient je, tu. le fichier-2 il, nous.
le fichier-3 vous, ils
viola comment faire pour que mon script quand il trouve
le pronom (je) s'arrete et ne vas pas chercher dans les autres fichier
merci reponse
2 réponses
-
essaye (pas testé):
if grep -w fichier-1 fichier-2 fichier-3 $le
then exit 0
fi
Pour en savoir plus:
man grep sur UNIX
http://unixhelp.ed.ac.uk/ -
j'ai trouvé
printf "\n1. recherche pronom\n"
read choix;
if [ $choix = "1" ]; then
printf "\tle pronom ?"
read le;
grep -w fichier-* $le
fi
exit 0
merci