On Mon, 28 Oct 2002 12:16:45 +0100, Benoit Mordelet <[EMAIL PROTECTED]>
wrote to [email protected]:

> cat fichier.txt | perl -e 'my $tmp = ""; while (<>) {chop $tmp if 
> (/^!/); print $tmp; $tmp = $_;}' > final.txt

Je pense que ça devrait être "chomp $tmp" plutôt que "chop $tmp"...

Aussi, il ne faut pas oublier de recracher la dernière ligne :

while ( <> ) {
  chomp $tmp if ( /^!/ );
  print $tmp;
  $tmp = $_;
}
print $_;


-- 
G. Stewart   --   [EMAIL PROTECTED]
                  [EMAIL PROTECTED]
Registered Linux user #284683

GnuPG key  : BA3D01C6 (pgp.mit.edu)
Fingerprint: C3DF C686 6572 6E59 E3E4  0F40 2B9A 2218 BA3D 01C6
---------------------------------------------------------------
There is a theory which states that if ever anybody discovers exactly
what the Universe is for and why it is here, it will instantly disappear
and be replaced by something even more bizarre and inexplicable. There
is another theory which states that this has already happened.

Linux-Azur :      http://www.linux-azur.org
Désinscriptions: http://www.linux-azur.org/liste.php3
**** Pas de message au format HTML, SVP ****

Répondre à