avec une liste de fichier semblable à celle-ci (liste.txt):

01impress_ht_debuter.pdf
Chandler_linux_0.6.i386.tar.gz
DOKU_OFF_V_1.pdf
Pathc+ & TM1000CI_04-01-06.zip
XYfuvSn
Zimbra Collaboration Suite Data Sheet.pdf
Zimbra Quick Start.pdf
ad-ldapsearch.txt

la commande suivante (ATTENTION il y a vraiment un carriage return après
IFS=' : 
haring tmp # OLDIFS=$IFS; IFS='
'; for i in $(cat liste.txt); do echo "fichier [$i]"; done; IFS=$OLDIFS

me donne comme résultat :

fichier [01impress_ht_debuter.pdf]
fichier [Chandler_linux_0.6.i386.tar.gz]
fichier [DOKU_OFF_V_1.pdf]
fichier [Pathc+ & TM1000CI_04-01-06.zip]
fichier [XYfuvSn]
fichier [Zimbra Collaboration Suite Data Sheet.pdf]
fichier [Zimbra Quick Start.pdf]
fichier [ad-ldapsearch.txt]

IFS permet de changer les séparateurs des commandes, par défaut c'est
l'espace,la tablulation et le \n


On Wed, 2006-01-25 at 13:49 +0100, Rémi Letot wrote:
> On Wed, 2006-01-25 at 13:14 +0100, Frédéric Descamps wrote:
> > voilà ce qu'il faut faire :
> > 
> > OLDIFS=$IFS; IFS=' > '; for i in $(cat liste.txt); do echo "fichier
> > [$i]"; done; IFS=$OLDIFS
> 
> Je ne sais pas exactement ce que c'était sensé faire, mais ça n'a pas
> marché. Pourrais-tu expliquer la commande ?
> 
> A+,
-- 
Best regards,

Fred.

\  /
 \/__ T e n d
 /\      Frédéric Descamps
/  \     Senior Linux Consultant 
         RedHat Certified Engineer  - MySQL Core & Pro Certified
-------------------------------------------------------------------------------
(o-                                          Linux Rules
//\                                      No HTML in emails
V_/_                             http://www.x-tend.be/~fred
-------------------------------------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________________
Linux Mailing List - http://www.unixtech.be
Subscribe/Unsubscribe: http://lists.unixtech.be/cgi-bin/mailman/listinfo/linux
Archives: http://www.mail-archive.com/linux@lists.unixtech.be
IRC: chat.unixtech.be:6667 - #unixtech
NNTP: news.gname.org - gmane.org.user-groups.linux.unixtech

Reply via email to