Text processing/2: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
Line 228: Line 228:
duplicate 19950326 line
duplicate 19950326 line
5017 good lines</pre>
5017 good lines</pre>


=={{header|Amazing Hopper}}==
{{Trans|AWK}}
<syntaxhighlight lang="c">
#include <basico.h>

algoritmo

número de campos correcto = `awk 'NF != 49' basica/readings.txt`

fechas repetidas = `awk '++count[$1] >= 2{print $1, "(",count[$1],")"}' basica/readings.txt`

resultados buenos = `awk '{rec++;ok=1; for(i=0;i<24;i++){if($(2*i+3)<1){ok=0}}; recordok += ok} END {print "Total records",rec,"OK records", recordok, "or", recordok/rec*100,"%"}' basica/readings.txt`

"Check field number by line: ", #( !(number(número de campos correcto)) ? "Ok\n" : "Nok\n";),\
"\nCheck duplicated dates:\n", fechas repetidas,NL, \
"Number of records have good readings for all instruments:\n",resultados buenos,\
"(including "
fijar separador( NL )
contar tokens en 'fechas repetidas'
" duplicated records)\n", luego imprime todo

terminar
</syntaxhighlight>
{{out}}
<pre>
Check field number by line: Ok

Check duplicated dates:
1990-03-25 ( 2 )
1991-03-31 ( 2 )
1992-03-29 ( 2 )
1993-03-28 ( 2 )
1995-03-26 ( 2 )

Number of records have good readings for all instruments:
Total records 5471 OK records 5017 or 91,7017 %
(including 5 duplicated records)

</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==