Perl Supprimer redondance dans paragraphe
Fermé
orlando_84
Messages postés
6
Date d'inscription
jeudi 25 février 2010
Statut
Membre
Dernière intervention
4 mars 2010
-
25 févr. 2010 à 19:29
orlando_84 Messages postés 6 Date d'inscription jeudi 25 février 2010 Statut Membre Dernière intervention 4 mars 2010 - 4 mars 2010 à 09:44
orlando_84 Messages postés 6 Date d'inscription jeudi 25 février 2010 Statut Membre Dernière intervention 4 mars 2010 - 4 mars 2010 à 09:44
A voir également:
- Perl Supprimer redondance dans paragraphe
- Supprimer compte instagram - Guide
- Supprimer une page word - Guide
- Supprimer compte facebook - Guide
- Supprimer compte gmail - Guide
- Supprimer edge - Guide
3 réponses
orlando_84
Messages postés
6
Date d'inscription
jeudi 25 février 2010
Statut
Membre
Dernière intervention
4 mars 2010
25 févr. 2010 à 19:58
25 févr. 2010 à 19:58
j'avais commencez un script en shell sur linux (grep -e , sed, sort -u)
mais celui ci n'ai pas compatible avec un Sun
donc je me rabattu sur le PERL
mais celui ci n'ai pas compatible avec un Sun
donc je me rabattu sur le PERL
dubcek
Messages postés
18587
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
12 mars 2023
5 583
26 févr. 2010 à 09:00
26 févr. 2010 à 09:00
hello
avec awk:
Sur Solaris, utiliser nawk
avec awk:
Sur Solaris, utiliser nawk
$ cat a1
For AAAAAAAAAAAA
toto
toto
toto
toto
tata
tata
tata
titi
For BBBBBBBBBB
toto
toto
tata
titi
$ awk '/For/ {print;i=$0;next}; {if(!x[$0,i])print;x[$0,i]=$0}' < a1
For AAAAAAAAAAAA
toto
tata
titi
For BBBBBBBBBB
toto
tata
titi
$
orlando_84
Messages postés
6
Date d'inscription
jeudi 25 février 2010
Statut
Membre
Dernière intervention
4 mars 2010
4 mars 2010 à 09:44
4 mars 2010 à 09:44
Voici ma solution
open(FILE_TEMP, "<FILE_TEMP") or die "Cannot open fichier : $!";
open(FILE_FINAL, ">FILE_FINAL") or die "Cannot open fichier : $!";
my @FILE_TABLE= <FILE_TEMP>;
my $i = 0;
foreach my $element (@FILE_TABLE) {
if ($element ne $FILE_TABLE[$i+1]) {
print FILE_FINAL $element;
}
$i++;
}
close (FILE_FINAL);
close (FILE_TEMP);
open(FILE_TEMP, "<FILE_TEMP") or die "Cannot open fichier : $!";
open(FILE_FINAL, ">FILE_FINAL") or die "Cannot open fichier : $!";
my @FILE_TABLE= <FILE_TEMP>;
my $i = 0;
foreach my $element (@FILE_TABLE) {
if ($element ne $FILE_TABLE[$i+1]) {
print FILE_FINAL $element;
}
$i++;
}
close (FILE_FINAL);
close (FILE_TEMP);