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

Re: [linux-team] question sed



Ralala, Pascal, tu ne changeras jamais... 

Imaginez donc la geule du resultat de la commande sur sa caisse:

cat ~/.bash_history

:)

- --------------------------------------- -
- Dive Jean-Francois - Analyst Programmer -
-                                         -
- <http://linuxbe.org>                    -
- <dive@linuxbe.org>                      -
- <133 Rue Pierre Henvard>                -
- <4053 Embourg Belgium>                  -
- <0032/477.893.309>                      -
- --------------------------------------- - 
-      **** In Linux we trust ****        -
- --------------------------------------- - 



On Thu, 29 Apr 1999, Pascal Bleser wrote:

> Tout à fait d'accord avec Alain pour le Perl, mais juste pour le fun...
> voici la même chose avec awk:
> 
> cat brol \
> | awk '/lalignearemplacer-cestuneregexp/ { print "blah\nblah2\nblah3\n"; next } { print $0 }'
> 
> voilou...
> 
> > #!/usr/bin/perl
> > # ----------------------
> > while (<>) {
> >   if ( /target/ ) {
> >     print "hhgfhg \n";
> >     print "hhgfhg \n";
> >     ...
> >   }
> >   else { print;
> >   }
> > }
> > # ----------------------
> > C'est plus long, mais beaucoup plus souple et plus lisible.
> 
> Tu peux raccourcir:
> 
> cat brol \
> | perl -ne 'if (/target/) { print "blahblah\nblahblah2\n"; } else { print $_; }'
> 
>   -o)  Pascal Bleser        | UNIX *is* user friendly.
>   /\\  C++/UNIX Development | It's just selective about
>  _\_v  ATOS Payment Systems | who its friends are...
> pbleser@atos-group.com---------------------------------
> ---------
> This message was sent by Majordomo 1.94.3. Please report problems to
> manu@rtfm.be. If you want to be deleted from the list, send a mail to
> majordomo@rtfm.be with "unsubscribe linux-team" in the body.
> 

---------
This message was sent by Majordomo 1.94.3. Please report problems to
manu@rtfm.be. If you want to be deleted from the list, send a mail to
majordomo@rtfm.be with "unsubscribe linux-team" in the body.