Re,
Désole
kamaris, mais j'ai d'abord répondu à
beuguissime.
Bizarrement, ta commande ne renvoie aucun retour !
Voici :
tawal@Deb1:~$ time find /home/tawal -type f -exec file -00 {} + | awk 'BEGIN{RS="\0"} (NR % 2 == 1){file=$0; next} /text/{files[n++]=file} END{for (i=0;i<n;i++) printf("%s\0",files[i])}' | xargs -0 grep -H tawal
real 10m38,144s
user 3m39,745s
sys 0m23,630s
tawal@Deb1:~$ echo ${PIPESTATUS[@]}
0 0 123
tawal@Deb1:~$
Par contre coté performance ... rien à dire 😉
J'avais bien compris le souci du flux, mais ma méconnaissance d'
awk ne me permet pas de le garder intact.
J'ai su déchiffrer ta formulation mais je serais incapable de la reproduire intuitivement.
Merci bien de ta clarté.
Edit: le format de flux serait-il encore brisé par awk ?
Edit2: Le code retour 123 concerne xargs et j'ai trouvé ceci :
123 means that at least one of xargs's invocations of grep returned a non-zero error code
Donc, au moins un nom de fichier est passé au travers je pense.
Edit3: En fait ton
awk ne fonctionne pas :
tawal@Deb1:~/Term/evil-name/evil$ find -type f -exec file -00 {} +
./` ! @ # $ % ^ & * ( ) _ - + ~ =ASCII text./(xyz)ASCII text./-n --forceASCII text./xyz ASCII text./"ASCII text./.abcASCII text./ASCII text./
x
y
ASCII text./x y zASCII text./ASCII text./x y zASCII text./~rootASCII text./x
yASCII text./\nASCII text./~ASCII text./ASCII text./
x
y
ASCII text./. ASCII text./ASCII text./ASCII text./QASCII text./-ASCII text./\\ASCII text./!-1ASCII text./.. ASCII text./; : < > , . ?ASCII text./
x
y
ASCII text./ZZASCII text./xyzASCII text./--ASCII text./xyASCII text./
ASCII text./.a bcASCII text./BADASCII text./
ASCII text./In colorNot in colorASCII text./\ASCII text./xyzASCII text./not-control-\tyASCII text./--forceASCII text./ xyz ASCII text./
x
y
ASCII text./!!ASCII text./'ASCII text./xy[az]ASCII text./xyz ASCII text./*ASCII text./{} [] | " "ASCII text./x yASCII texttawal@Deb1:~/Term/evil-name/evil$
tawal@Deb1:~/Term/evil-name/evil$ find -type f -exec file -00 {} + | awk 'BEGIN{RS="\0"} (NR % 2 == 1){file=$0; next} /text/{files[n++]=file} END{for (i=0;i<n;i++) printf("%s\0",files[i])}'
tawal@Deb1:~/Term/evil-name/evil$ echo ${PIPESTATUS[@]}
0 0
tawal@Deb1:~/Term/evil-name/evil$