Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
50
Task/Text-processing-2/SNOBOL4/text-processing-2.sno
Normal file
50
Task/Text-processing-2/SNOBOL4/text-processing-2.sno
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
* Read text/2
|
||||
|
||||
v = array(24)
|
||||
f = array(24)
|
||||
tos = char(9) " " ;* break characters are both tab and space
|
||||
pat1 = break(tos) . dstamp
|
||||
pat2 = span(tos) break(tos) . *v[i] span(tos) (break(tos) | (len(1) rem)) . *f[i]
|
||||
rowcount = 0
|
||||
hold_dstamp = ""
|
||||
num_bad_rows = 0
|
||||
num_invalid_rows = 0
|
||||
|
||||
in0
|
||||
row = input :f(endinput)
|
||||
rowcount = rowcount + 1
|
||||
row ? pat1 = :f(invalid_row)
|
||||
|
||||
* duplicated datestamp?
|
||||
* if dstamp = hold_dstamp then duplicated
|
||||
hold_dstamp = differ(hold_dstamp,dstamp) dstamp :s(nodup)
|
||||
output = dstamp ": datestamp at row " rowcount " duplicates datestamp at " rowcount - 1
|
||||
nodup
|
||||
|
||||
i = 1
|
||||
in1
|
||||
row ? pat2 = :f(invalid_row)
|
||||
i = lt(i,24) i + 1 :s(in1)
|
||||
|
||||
* Is this a goodrow?
|
||||
* if any flag is < 1 then row has bad data
|
||||
c = 0
|
||||
goodrow
|
||||
c = lt(c,24) c + 1 :f(goodrow2)
|
||||
num_bad_rows = lt(f[c],1) num_bad_rows + 1 :s(goodrow2)f(goodrow)
|
||||
goodrow2
|
||||
|
||||
:(in0)
|
||||
|
||||
invalid_row
|
||||
num_invalid_rows = num_invalid_rows + 1
|
||||
:(in0)
|
||||
|
||||
endinput
|
||||
output =
|
||||
output = "Total number of rows : " rowcount
|
||||
output = "Total number of rows with invalid format: " num_invalid_rows
|
||||
output = "Total number of rows with bad data : " num_bad_rows
|
||||
output = "Total number of good rows : " rowcount - num_invalid_rows - num_bad_rows
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue