Deja merci de toute ces reponses. J'ai bien modifié quelque trucs. J'ai bien avancé et j'arrive bientot au bout. Du moins je l’espère. La commande
$ tac bdd.txt | awk 'BEGIN{sortie="";} {sortie = ""sortie""((sortie=="")?"":"\n")""$0;} ($3!=""){if (a[$1,$3]==0) {print sortie;} sortie="";a[$1,$3]++;}' |tac
marche bien.
Mais elle ne marche pas tous le temps. A vrai dire vu que je comprends pas le probleme je vais avoir du mal a expliqué. On va avoir des fois lors de la modfication d'un fichier.txt une concaténation de caractere d'autre fois ça ne modifie meme pas le fichier.txt . Ce qui marche c'est quand on a 1 fichier.txt. Mais lorsque qu'il y a 15 fichier.txt et que on commence a en modifié plusieurs alors la c'est la catastrophe
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| for i in find -name "*"".txt"
do
if test -f "$i"
then
name=${i##*/} #recupération du nom fichier
empreinteadresse=$(md5sum "$i") #recuperation de l'empreinte fichier
empreinte=echo "$empreinteadresse" | cut -f 1 -d ' '
adressefichier=$(readlink -f "$name")
if test -s "$cheminbash/bdd.txt"
then
while read line
do
adressetest=echo "$line" | cut -f 3 -d ' '
firsttest=echo "$line" | cut -f 1 -d ' '
then
testempreinte=echo $line | cut -f 2 -d ' '
cheminacces=echo $line | cut -f 3 -d ' '
if grep -q "$empreinte" "$cheminbash/bdd.txt"
then
test="nonvalide"
else
echo "$name" "$empreinte" "$adressefichier" >> "$cheminbash/bdd.txt" #on mets name et empreinte dans la bdd.txt
"$cheminbash"/projetjohncpp.exe "$i" "$cheminbash/bdd.txt"
echo "tac "$cheminbash/bdd.txt" | awk 'BEGIN{sortie="";} {sortie = ""sortie""((sortie=="")?"":"\n")""$0;} ($3!=""){if (a[$1,$3]==0) {print sortie;} sortie="";a[$1,$3]++;}' |tac" > "$cheminbash/bdd.txt"
fi
fi
done < "$cheminbash/bdd.txt"
else
echo "$name" "$empreinte" "$adressefichier" >> $cheminbash"/bdd.txt" #on mets name et empreinte dans la bdd.txt
"$cheminbash"/projetjohncpp.exe "$i" "$cheminbash/bdd.txt" |
Partager