Je préfère primer la visibilité au "tout compacté" pour les que gens qui
repassent derrières arrivent à dépatouiller le script si besoin.
Le 1 juillet 2010 09:54, Piel Jayce <jayce@???> a écrit :
>
> En poussant un peu, on pourrait aussi faire dans le find le test que tu
> fais dans le if...
>
> Et du coup, tu n'aurais même pas besoin de la boucle for... Mais là, ça
> deviendrait un peu moins lisible...
>
> Le 30 juin 10 à 14:32, Freenawak a écrit :
>
>
> En effet merci, c'était presque trop simple.
>>
>> 2010/6/29 Piel Jayce <jayce@???>
>>
>>
>>> Je ferais simplement
>>>
>>> for K in find /log/c1_grh1/ordo/ -type f -name \*100624\*.o
>>> do
>>> ...
>>> done
>>>
>>> Le 25 juin 10 à 14:29, Freenawak a écrit :
>>>
>>> Bonjour c'est encore moi ...
>>>
>>>>
>>>> J'essaie de travailler sur les fichiers d'un repertoire.
>>>>
>>>> for K in ls /log/c1_grh1/ordo/*100624*.o
>>>> do
>>>> if [ $(tail -n 1 $K | cut -d' ' -f 3) = '[255]' ] #va chercher dans
>>>> le fond du fichier si c'est egale à [255]
>>>> then
>>>> echo $K > TMP_255 #alors on copie le nom entier sur fichier dans un
>>>> txt
>>>> fi
>>>> done
>>>>
>>>> Cela fonctionne mais me renvoie des erreurs curieuses :
>>>> ls: A file or directory in the path name does not exist.
>>>> ./rhum255.ksh[18]: test: 0403-004 Specify a parameter with this command.
>>>> (la
>>>> ligne 18 est le if)
>>>>
>>>> un collègue me propose à la place de mon ls
>>>>
>>>> for K in " find /log/c1_grh1/ordo/ -type f -exec ls -1 *100624*.o {} \;
>>>> "
>>>> do
>>>> [...]
>>>>
>>>> Réponse :
>>>>
>>>> tail: 0652-044 Can only process one file at a time.
>>>> ./rhum255.ksh[18]: test: 0403-004 Specify a parameter with this command.
>>>>
>>>> Comment fait un "ls" propre pour travailler sur les fichiers trouvés
>>>> ensuite
>>>> ?
>>>> _______________________________________________
>>>> archives :
>>>> http://listes.patpro.net/list/sshfr.fr.html
>>>> http://listes.patpro.net/mailman/listinfo/script_shell_fr
>>>>
>>>>
>>>> --
>>> Jayce Piel
>>> MosX.org
>>> la renaissance.....
>>>
>>>
>>> _______________________________________________
>>> archives :
>>> http://listes.patpro.net/list/sshfr.fr.html
>>> http://listes.patpro.net/mailman/listinfo/script_shell_fr
>>>
>>> _______________________________________________
>> archives :
>> http://listes.patpro.net/list/sshfr.fr.html
>> http://listes.patpro.net/mailman/listinfo/script_shell_fr
>>
>>
> --
> Jayce Piel
> MosX.org
> la renaissance.....
>
>
> _______________________________________________
> archives :
> http://listes.patpro.net/list/sshfr.fr.html
> http://listes.patpro.net/mailman/listinfo/script_shell_fr
>
_______________________________________________
archives :
http://listes.patpro.net/list/sshfr.fr.html
http://listes.patpro.net/mailman/listinfo/script_shell_fr