#1 Le 30/12/2019, à 17:07
- philoeil
[RESOLU] Commande AWK Tableau ne retournant pas la valeur attendue
Bonjour,
je souhaite récupérer le nombre de doublons par répertoire,
Les infos des doublons ont été préalablement rassemblées dans le fichier "REP"
le code suivant échoue. Pouvez-vous m'expliquer ?
echo "Ci-après la liste des noms des répertoires contenant des doublons"
awk -F' § ' 'BEGIN { print "Info2 " }
{
if (/^\s*§+/) { next }
else
{ print "==========NR= " NR "**********" $1 }
}
END { print "INFO2 terminée"} ' $REP
echo "Ci-après la liste des noms des répertoires avec le nombre de doublons dans ce répertoire"
awk -F' § ' 'BEGIN { print " Info3 " }
{
if (/^\s*§+/) { next }
else
{ NomRep[$1]==$1; NbRepDbl[$1]+=1 }
}
END {
for ( Dblon in NbRepDbl) {
printf("Repertoire doublon : %15d ===> %3d doublons\n" , NomRep[Dblon] , NbRepDbl[Dblon])
}
}' $REP
Le fichier REP :
§§§§§§ Empreinte MD5 identique pour : 28a07d4c607ad7aee69583b110e3c6bf des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_02_Otan Harazi.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.1 § Rep2.1.Elisa Vellia_Voleur de Secrets_02_Otan Harazi.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_02_Otan Harazi.mp3
§§§§§§ Empreinte MD5 identique pour : 3681351dbd8aab4ae94b010c02f02cce des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.2 § Rep2.2.Platinum Collection Disc 1_01_Gabriel's Oboe.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Platinum Collection Disc 1_01_Gabriel's Oboe.mp3
§§§§§§ Empreinte MD5 identique pour : 415dcf8f85ce7a1b5e3a4583ef9863b0 des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_05_Le Guide des Étoiles.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_05_Le Guide des Étoiles.mp3
§§§§§§ Empreinte MD5 identique pour : 6a56c854a1f336468860bebc5033202b des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_04_Voleur de Secrets.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_04_Voleur de Secrets.mp3
§§§§§§ Empreinte MD5 identique pour : 874855a482ee84fe4a2163a6679dedf3 des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_06_Yar Ko Parag.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_06_Yar Ko Parag.mp3
§§§§§§ Empreinte MD5 identique pour : a13a85c3b31e4c6b21c6dfcd0afcc7f0 des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_08_Astrapse I Anatoli.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_08_Astrapse I Anatoli.mp3
§§§§§§ Empreinte MD5 identique pour : cb25a3284c67db9c42f42993e5bca369 des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.2 § Rep2.2.Platinum Collection Disc 1_02_Il Buono, Il Brutto, Il Cattivo.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Platinum Collection Disc 1_02_Il Buono, Il Brutto, Il Cattivo.mp3
§§§§§§ Empreinte MD5 identique pour : d17c9312f6b705f89ff4db625f379ac0 des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_03_Le Chant de Yestimani.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_03_Le Chant de Yestimani.mp3
§§§§§§ Empreinte MD5 identique pour : d3fad710647642c327aceeec1b773a71 des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_07_Valse du Printemps Égaré (Instrumental).mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_07_Valse du Printemps Égaré (Instrumental).mp3
§§§§§§ Empreinte MD5 identique pour : d6eb958ed7ab196838f32f1de0717d8c des fichiers suivants :
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1 § Elisa Vellia_Voleur de Secrets_01_Ena Ohi.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.1 § Rep2.1.Elisa Vellia_Voleur de Secrets_01_Ena Ohi.mp3
/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2 § Rep2Elisa Vellia_Voleur de Secrets_01_Ena Ohi.mp3
Merci pour votre aide
Dernière modification par philoeil (Le 30/12/2019, à 17:43)
Hors ligne
#2 Le 30/12/2019, à 17:18
- Watael
Re : [RESOLU] Commande AWK Tableau ne retournant pas la valeur attendue
salut,
qu'obtiens-tu avec le code affiché ?
et que souhaites-tu obtenir ?
je doute que ça ne puisse pas être moins tortueux...
Dernière modification par Watael (Le 30/12/2019, à 17:20)
Connected \o/
Welcome to sHell. · eval is evil.
En ligne
#3 Le 30/12/2019, à 17:23
- philoeil
Re : [RESOLU] Commande AWK Tableau ne retournant pas la valeur attendue
Merci Watael
J'obtiens ceci :
Ci-après la liste des noms des répertoires contenant des doublons
==========NR= 2**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 3**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.1
==========NR= 4**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 6**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.2
==========NR= 7**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 9**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 10**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 12**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 13**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 15**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 16**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 18**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 19**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 21**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.2
==========NR= 22**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 24**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 25**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 27**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 28**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
==========NR= 30**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep1
==========NR= 31**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2/Rep2.1
==========NR= 32**********/home/phil/Documents/JeCodeShell/ShellEssaiRepDblons/Racine/Rep2
INFO2 terminée
Ci-après la liste des noms des répertoires avec le nombre de doublons dans ce répertoire
Repertoire doublon : 0 ===> 8 doublons
Repertoire doublon : 0 ===> 10 doublons
Repertoire doublon : 0 ===> 2 doublons
Repertoire doublon : 0 ===> 2 doublons
phil@phil-G750JH:~/Documents/JeCodeShell/ReschDoublonSD5$
Hors ligne
#4 Le 30/12/2019, à 17:37
- pingouinux
Re : [RESOLU] Commande AWK Tableau ne retournant pas la valeur attendue
Bonjour,
La ligne n° 19 devrait être (NomRep[$1]==$1 devient NomRep[$1]=$1
{ NomRep[$1]=$1; NbRepDbl[$1]+=1 }
et la ligne n° 23 (%15d devient %15s)
printf("Repertoire doublon : %15s ===> %3d doublons\n" , NomRep[Dblon] , NbRepDbl[Dblon])
Hors ligne
#5 Le 30/12/2019, à 17:42
- philoeil
Re : [RESOLU] Commande AWK Tableau ne retournant pas la valeur attendue
Bonjour,
Merci bien pingouinux, c'est resolu
Hors ligne
#6 Le 30/12/2019, à 19:38
- Watael
Re : [RESOLU] Commande AWK Tableau ne retournant pas la valeur attendue
je continue de penser que l'algo est tortueux.
Connected \o/
Welcome to sHell. · eval is evil.
En ligne