Text processing/2: Difference between revisions

(removed omit from phix)
Line 101:
 
=={{header|Aime}}==
<lang aime>voidcheck_format(list l)
check_format(list l)
{
integer i;
Line 108 ⟶ 107:
 
if (~l != 49) {
error("wrongbad numberfield of fieldscount");
}
 
s = l[0];
if (~s != 10 || s[4] != 'match("????-' ||??-??", s[7] != '-')) {
error("bad date format");
}
l[0] = atoi(s.delete(7).delete(s, 7), 4)).atoi;
 
i = 1;
while (i < 49) {
l[i] = atof(l[i]);
i += 1;
l[i >> 1] = atoi(l[i]);
i += 1;
}
 
l.erase(25, -1);
}
 
integer
main(void)
{
Line 140:
while (f.list(l, 0) != -1) {
if (!trap(check_format, l)) {
if (x.key(x[v = lf_picklf_x_integer(l)] += 1) != 1) {
v_form("duplicate ~ line\n", v);
}
 
x[v] = 0;
i = 1;
while l.ucall(imin_i, <1, 48i) {;
goods += iclip(0, if (l[i] <, 1) {;
break;
}
i += 2;
}
if (48 < i) {
goods += 1;
}
}
}
Line 160 ⟶ 152:
o_(goods, " good lines\n");
 
return 0;
}</lang>
{{out}} (the "reading.txt" needs to be converted to UNIX end-of-line)
Anonymous user