Text processing/2: Difference between revisions

Content added Content deleted
(jq)
m (ce introduction)
Line 1: Line 1:
{{task|Text processing}}
{{task|Text processing}}
The following task concerns data that came from a pollution monitoring station with twenty-four instruments monitoring twenty-four aspects of pollution in the air. Periodically a record is added to the file, each record being a line of 49 fields separated by white-space, which can be one or more space or tab characters.
The following data shows a few lines from the file readings.txt (as used in the [[Data Munging]] task).

The data comes from a pollution monitoring station with twenty four instruments monitoring twenty-four aspects of pollution in the air. Periodically a record is added to the file, each record being a line of 49 white-space separated fields, where white-space can be one or more space or tab characters.


The fields (from the left) are:
The fields (from the left) are:
DATESTAMP [ VALUEn FLAGn ] * 24
DATESTAMP [ VALUEn FLAGn ] * 24
i.e. a datestamp followed by twenty four repetitions of a floating-point instrument value and that instrument's associated integer flag. Flag values are >= 1 if the instrument is working and < 1 if there is some problem with that instrument, in which case that instrument's value should be ignored.
i.e. a datestamp followed by twenty-four repetitions of a floating-point instrument value and that instrument's associated integer flag. Flag values are >= 1 if the instrument is working and < 1 if there is some problem with it, in which case that instrument's value should be ignored.

A sample from the full data file [http://rosettacode.org/resources/readings.zip readings.txt] is:
A sample from the full data file [http://rosettacode.org/resources/readings.zip readings.txt], which is also used in the [[Data Munging]] task, follows:
<pre style="height:17ex;overflow:scroll">
<pre style="height:17ex;overflow:scroll">
1991-03-30 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1
1991-03-30 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1 10.000 1
Line 21: Line 19:
# Confirm the general field format of the file.
# Confirm the general field format of the file.
# Identify any DATESTAMPs that are duplicated.
# Identify any DATESTAMPs that are duplicated.
# Report the number of records have good readings for all instruments.
# Report the number of records that have good readings for all instruments.


=={{header|Ada}}==
=={{header|Ada}}==