Bonjour,

Dans un script Shell, j'exécute une requête SQL de sélection à l'aide de la commande "sqlplus".

Voici le résultat de cette requête :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[ticket 36]
InternalMU;CONSTRUCTED;
InternalMU.contexteAppel;CONSTRUCTED;
InternalMU.contexteAppel.nature;STRING;GSM
InternalMU.contexteAppel.codeFermetureCom;STRING;N
InternalMU.contexteAppel.idPFI;STRING;0
[ticket 39]
InternalMU;CONSTRUCTED;
InternalMU.contexteAppel;CONSTRUCTED;
InternalMU.contexteAppel.nature;STRING;GSM
InternalMU.contexteAppel.idPFI;STRING;0
[ticket 40]
InternalMU;CONSTRUCTED;
InternalMU.contexteAppel;CONSTRUCTED;
InternalMU.contexteAppel.nature;STRING;GSM
InternalMU.contexteAppel.idPFI;STRING;0
[ticket 48]
InternalMU;CONSTRUCTED;
InternalMU.contexteAppel;CONSTRUCTED;
InternalMU.contexteAppel.nature;STRING;GSM
InternalMU.contexteAppel.codeFermetureCom;STRING;N
InternalMU.contexteAppel.idPFI;STRING;0
[ticket 63]
InternalMU;CONSTRUCTED;
InternalMU.contexteAppel;CONSTRUCTED;
InternalMU.contexteAppel.nature;STRING;GSM
InternalMU.contexteAppel.codeFermetureCom;STRING;N
InternalMU.contexteAppel.idPFI;STRING;0
Ensuite, j'ai besoin de splitter le résultat dans plusieurs fichiers en fonction de la règle suivant : Au bout de 3 tickets, je change de fichier. Je détecte le début d'un ticket car la ligne commence toujours par [ticket n]

On m'a conseillé d'utiliser la commande awk, mais je ne sais pas du tout comment l'utiliser donc si quelqu'un sait comment faire...

Merci d'avance

Dany