Grep sur trois fichier

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
A voir également:

2 réponses

emmanuelP Messages postés 137 Statut Contributeur 161
 
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/
0
togian
 
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
0