Bonjour,
J'ai besoin d'imbriquer des awk. Comme la commande awk n'est pas une commande awk, j'utilise la commande system :
awk '
$1=="[PATH]" {
myPath=$2
print "Traitement du répertoire " $2
}
$1=="[FILE]" {
print " Traitement du fichier " $2
ficPrincipal=myPath $2
ficCorrection=myPath $3
ficBase=myPath "base_" $2
ficTab=myPath "tab_" $2
echo "" > ficBase;
echo "" > ficTab;
system(awk '
BEGIN {flag=1}
flag<=1 && $1=="FREQUENCY" {print $0 >> ficBase; flag=2}
flag<=2 && $1!="1" {print $0 >> ficBase}
flag==2 && $1=="1" || flag>=3 {flag=3; print $2 " " $3 >> ficTab}
')
}
' listeGraph
Le script n'est pas fini, mais déjà, il me jette :
$ bash creeGraph
awk: cmd. line:14: system(awk
awk: cmd. line:14: ^ unexpected newline or end of string
creeGraph: line 16: =1: No such file or directory
creeGraph: line 17: =2: No such file or directory
creeGraph: line 18: ==1: command not found
creeGraph: line 18: flag: command not found
creeGraph: line 21: )
}
: command not found
Quelqu'un saurait-il comment faire ?
Poste le Friday 6 April 2007 15:27:37