[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: HS - shell concaténer des chaines



Une facon parmi d'autres:

chaine=`cat mon_fic | perl -pe 's/\n//g'`

A+, JD.

On Monday 16 May 2005 18:09, Fabrice Régnier wrote:
FR > salut la liste ;)
FR > 
FR > Je lis un fichier ligne par ligne et je voudrais concaténer toutes mes 
FR > lignes dans une seule variable. Mais je bute sur la concaténation. Si 
FR > quelqu'un peut m'aider ;)
FR > 
FR > 
FR > cat mon_fic | while read ligne
FR > do
FR >    variable=`echo $ligne`
FR > 
FR >    #c'est ici que ça cloche
FR >    chaine=$chaine$ligne
FR > 
FR > done
FR > 
FR > echo $chaine
FR > 
FR > 
FR > a+
FR > 
FR > f.
FR > 
FR > 

-- 
Jean-Damien Durand CERN/IT/ADC/CA - Geneva, Switzerland
PGP PUBLIC KEY: http://home.cern.ch/~jdurand/public_key.asc
This mail is signed using CERN CA, please use my PGP key otherwise
CERN CA root certificate: http://cern.ch/service-grid-ca/crt/root_crt.html



Reply to: