Display Tableau awk xml
to creat send with model CFTUTIL and xml desc of display
- Tableau colonnes 1er ligne fichier lu
#!/bin/sh ############################################## # # to creat send with model CFTUTIL and xml desc of display # ############################################## # ## . ~/.bash_profile ## sort -t' ' -k1,2 - |sed '1,19d'|grep -v "Pour generer"|awk '{ if (NR==1){ Npa=split($0,a," "); for (i=0;i<=Npa;i++){a[i]=toupper(a[i])} ; next } ; ### sort -t' ' -k1,2 - |sed '1,18d'|awk '{ if (NR==1){ Npa=split($0,a," "); for (i=0;i<=Npa;i++){a[i]=toupper(a[i])} ; next } ; sort -t' ' -k1,2 - |sed '1,18d'|awk '{ if (NR==1){ toupper($0) ; Npa=split($0,a," ");split($0,c," "); for (i=0;i<=Npa;i++){ c[i]=match($0,a[i]);a[i]=toupper(a[i])} ; next } ; ### Npb=split($0,b," "); if ( Npb -ne Npa ) { print "#####AVERTISSEMENT##### Manque valeur pour une ou des colonnes" }; Npb=split($0,b," "); printf("CFTUTIL send type=file, \\\n"); j=0; for (i=1;i<=Npa;i++) { j=j+1 ; if ( substr($0,c[i],1)==" " ) { printf(" %s=###Manque valeur colonne### %s\n",a[i],sep) ; i=i+1 ; loop } ; if ( substr($0,c[i],1)=="-" ) { b[j]="" } ; sep="";if (i<Npa){sep=", \\"} ; if ( a[i]=="STATE" ) { gsub("X","Disp",b[j]) ; gsub("H","Hold",b[j]) } ; if ( a[i]=="FCODE" ) { gsub("A","Ascii",b[j]) ; gsub("B","Binary",b[j]) } ; if ( a[i]=="PARM" ) {printf(" %s=\"'\''%s'\''\" %s\n",a[i],b[j],sep) } else { printf(" %s=%s %s\n",a[i],b[j],sep)} ; if ( a[i]=="FLRECL" ) { FLRECL=b[j] } ; if ( a[i]=="FNAME" ) { if ( b[j] ~ "/cftdata/CFT/EAIE" ) { printf("#ToRetFname# dsmc ret -verbose -replace=no /apps/data/CFT/REEL/CFT/EAI_CFTE.%s.L%06i.FFB %s\n",substr(b[j],19),FLRECL,b[j]) } else { printf("#####ToRetFname# dsmc ret -verbose -replace=no /apps/data/CFT/REEL/CFT/%s\n",substr(b[j],14)) }} ; } print " "; }' |egrep -v "NREC=|TREC=|DIAGI=|FDATE=|FTIME=|DATEE=|SENS=|IDT=" exit ################### le xml associer a l'appel CFTUTIL : CFTDSPCNF=/tmp/dspcnfsendfic.xml CFTUTIL display type=file,state=h ########## <?xml content='ascii'?> <!-- Filter Model for the CFTUTIL DISPLAY command CFTUTIL DISPLAY listcat-parameters + content= | STR <- nothing means first available + fmodel = DSPCNF | STR <- DSPCNF is system dependant : ex.: UNIX/Windows is DSPCNF an environment variable + mode = ANY | column | line <- ANY means use the model's + na = ANY | STR <- idem + empty = ANY | STR <- idem + help = NONE | FIELDS | MODELS <CFTDisplayFilter id='STR' mode = 'column|line' title_size = '-1|NUM' <- apply only in line mode title_align = 'left|center|right' <- apply only in line mode line_prefix = '|STR' line_suffix = '\n|STR' default_prefix = '|STR' default_suffix = ' |\n|STR' <- default is ' ' in column mode and '\n' in line mode default_empty = '-|STR' default_na = '#|STR' > <Fields> <Field id = 'ID' title = 'id|STR' <- default uses the id for the title name maxlength = '-1|NUM' <- default(-1) means that no length is used minlength = '-1|NUM' prefix = '|STR' suffix = '|STR' align = 'left|center|right' na = '|STR' empty = '|STR' /> <Fields> <CFTDisplayFilter> --> <!-- LISTCAT Model : classical CFTUTIL LISTCAT with long IDs --> <CFTDisplayFilter id ='listcat' title_align ='left' > <Fields> <Field id='PART' title='PART' /> <Field id='IDF' title='IDF' minlength='4' /> <Field id='NIDF' title='NIDF' minlength='4' /> <Field id='DIRECT' title='Sens' /> <Field id='STATE' title='State' align='left' /> <Field id='IDT' title='IDT' /> <Field id='FREC' title='Nrec' align='left' /> <Field id='NREC' title='Trec' align='left' /> <Field id='DATEE' title='Datee' /> <Field id='FTYPE' title='FTYPE' align='left' /> <Field id='FCODE' title='FCODE' align='left' /> <Field id='FRECFM' title='FRECFM' align='left' /> <Field id='FLRECL' title='FLRECL' align='left' /> <Field id='SUSER' title='Suser' maxlength='8' /> <Field id='RUSER' title='Ruser' maxlength='8' /> <Field id='PARM' title='Parm' /> <Field id='IDA' title='Ida' /> <Field id='FNAME' title='FNAME' /> </Fields> </CFTDisplayFilter>
Previous page: Codes error CFT
Page suivante : Extraire configuration