le lun 12-11-2001 � 14:18, [EMAIL PROTECTED] a �crit :
> 
> je me suis tromp�...
> 
> #!/usr/bin/perl
> #
> 
> 
> $file="/tmp/file.file";
> $expr="zsnes";
> $motif="%-%";
> 
> open FILE, $file || die "quel fichier ?";
> $d="debut";
> while (<FILE>) {
>         $d.=$_;
>       if ( $d =~ /$motif/) {
>               $d=~s/$motif//g;
>               if ($d =~ /$expr/) {
>                       print $d;
>               };
>               $d = "";
>       };
> };
> close FILE;
> 

ca marche pas
tu pourrais me faire voir si ca marche chez toi ?
Il s'ex�cute bien car j'ai test� la boucle
Il s�pare bien les bloc entre %-% et %-% ( mis un print $d; juste apr�s
$d=~s/$motif//g;
Cependant un truc bizarre est que le test ne marche pas ensuite avec
expr et donc il renvoie toujours une chaine vide.
Je pousse l'investigation plus loin.
> 
> 
> 
> 
> On Mon, 12 Nov 2001 [EMAIL PROTECTED] wrote:
> 
> >
> > Essaies �a
> > Je pense que �a devrait faire l'affaire m�me si �a v�rifie pas les "-"
> > On voit rarement des lignes avec deux fois ':' (?)
> > Si �a vas pas tu peux rajouter un ':' en rempla�ant l'expression :.*: par
> > :.*:.*:
> >
> >
> > #!/usr/bin/perl
> > #
> >
> > open FILE, "/tmp/fichier.file" || die "c'est quel fichier � traiter?";
> > while (<FILE>) {
> >         if ($_ =~ /:.*:/) {
> >             split /:/;
> >             print @_[0], "\n";
> >             };
> >     };
> > close FILE;
> >
> >
> >
> >
> >
> >
> > >                   Salut,
> > >
> > > bon les gars c'est un truc assez compliqu�.
> > > Soit un programme dont la sortie est quelquechose du genre :
> > > %-%
> > > nom:description:texte
> > > %-%
> > > %-%
> > > nom:description:texte
> > > %-%
> > >
> > > je voudrais r�cup�rer nom si et seulement si texte contient un motif que
> > > l'on va apell� motif.
> > > Pour cela je suis limit� � 2 outils : perl et grep.
> > > Note je peux utiliser un script ou une longue ligne perl.
> > >
> > > J'avais pens� � ne proc�dure et je voudrais savoir si c'est possible :
> > > d'abord faire perl couper entre les %-%, puis faire grep motif sur cette
> > > partie extraite, si grep renvoie r�ponse positive alors couper et
> > > renvoyer que le champ 1 ( $1 ) qui contient nom ou alors tout le texte.
> > > donc en gros un traitement qui s'applique sur les blocks compris entre
> > > %-% et %-%.
> > >
> > > je vais donner un exemple partique :
> > >
> > > [will@bastard rpmtools]$ ./parsehdlist --description
> > > /var/lib/urpmi/hdlist.contrib.cz
> > > [...]
> > > %-%
> > > zebra:description:GNU Zebra is a free software that manages TCP/IP based
> > > routing
> > > protocol.  It takes multi-server and multi-thread approach to resolve
> > > the current complexity of the Internet.
> > >
> > > GNU Zebra supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1, RIPv2, and RIPng.
> > >
> > > GNU Zebra is intended to be used as a Route Server and a Route
> > > Reflector.
> > > It is not a toolkit, it provides full routing power under a new
> > > architecture. GNU Zebra is unique in design in that it has a process
> > > for each protocol.
> > >
> > > See the file INSTALL for building and installation instructions.
> > >
> > > Please send all bug reports by electronic mail to: [EMAIL PROTECTED]
> > > %-%
> > > %-%
> > > ziptool:description:Medium protection is done by software for Iomega's
> > > JAZ and ZIP drives.
> > > jaztool and ziptool make this features available for Linux.
> > > %-%
> > > %-%
> > > zloe:description:An action-packed battle to the death that puts to the
> > > test the players'
> > > skill, cunning and reflexes, in a soul-wrenching, nerve-wracking,
> > > blood-chilling colliseum of evil.
> > > %-%
> > > %-%
> > > zsnes:description:This is an emulator for Nintendo's 16 bit console,
> > > called Super Nintendo
> > > Entertainment System or Super Famicom. It features a pretty accurate
> > > emulation
> > > of that system's graphic and sound capabilities.
> > > The GUI enables the user to select games, change options, enable cheat
> > > codes
> > > and to save the game state, even network play is possible.
> > > %-%
> > > %-%
> > > zssh:description:zssh (Zmodem SSH) is a program for interactively
> > > transferring files to/from
> > > a remote machine while using the secure shell (ssh). It is intended to
> > > be a
> > > convenient alternative to scp, allowing to transfer files without having
> > > to
> > > open another  session and re-authenticate  oneself. zssh is  an
> > > interactive
> > > wrapper for ssh used to switch  the ssh connection between the remote
> > > shell
> > > and  file transfers.  Files are  transferred through  the  zmodem
> > > protocol,
> > > using the rz and sz commands.
> > > %-%
> > >
> > > sortie non filtr�e. maintenant la sortie filtr� devrait me renvoy� au
> > > choix soit pour motif = protocol :
> > >
> > > zebra
> > > zssh
> > >
> > > ou soit :
> > > zebra:description:GNU Zebra is a free software that manages TCP/IP based
> > > routing
> > > protocol.  It takes multi-server and multi-thread approach to resolve
> > > the current complexity of the Internet.
> > >
> > > GNU Zebra supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1, RIPv2, and RIPng.
> > >
> > > GNU Zebra is intended to be used as a Route Server and a Route
> > > Reflector.
> > > It is not a toolkit, it provides full routing power under a new
> > > architecture. GNU Zebra is unique in design in that it has a process
> > > for each protocol.
> > >
> > > See the file INSTALL for building and installation instructions.
> > >
> > > Please send all bug reports by electronic mail to: [EMAIL PROTECTED]
> > >
> > > zssh:description:zssh (Zmodem SSH) is a program for interactively
> > > transferring files to/from
> > > a remote machine while using the secure shell (ssh). It is intended to
> > > be a
> > > convenient alternative to scp, allowing to transfer files without having
> > > to
> > > open another  session and re-authenticate  oneself. zssh is  an
> > > interactive
> > > wrapper for ssh used to switch  the ssh connection between the remote
> > > shell
> > > and  file transfers.  Files are  transferred through  the  zmodem
> > > protocol,
> > > using the rz and sz commands.
> > >
> > >
> > > Bon comme vous l'aurez compris c'est pour un outils de mandrake ( urpmf
> > > ) qui pose probl�me. J'ai essay� de voir d'o�venait le probl�me
> > > malheureusement je n'y connait rien en perl ( j'apprend depuis le man )
> > > et je ne suis pas tr�s fort en expression r�guli�re.
> > > Si quelqu'un trouve la r�ponse et que le changement est accept� dans le
> > > CVS de mandrakesoft, c'est s�r que je cite son nom dans mon entr�e CVS
> > > avec un gros merci ( de l� � savoir si cela apparaitra au changelog de
> > > la prochaine .... ).
> > >
> > >
> >
> >
> 
> -- 
> Thomas Nagy
> 
> DYSLEXICS OF THE WORLD, UNTIE!
> 
> 
> ----
> 

> Vous souhaitez acquerir votre Pack ou des Services MandrakeSoft?
> Rendez-vous sur "http://www.mandrakestore.com";
> 
-- 
http://perso.wanadoo.fr/linux_wizard/index.html 
-
<Czara1960> je ne peut pas monter mon cdrom avec KDE

                                                 - #linuxfr


Vous souhaitez acquerir votre Pack ou des Services MandrakeSoft?
Rendez-vous sur "http://www.mandrakestore.com";

Répondre à