collapsing-duplicate-record-sets.rex |
Pipelines v2.1 |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10... |
**** Top of file ****
1
2 /* The following pipeline reads the file: nyse.txt and collapses each set of duplicate
3 records. The pipeline formats the date and time fields and then selects the data section of
4 each record to determine which records are contiguous duplicates.
5
6 The pipeline illustrates how you can use the UNIQUE stage to operate on input data; selecting
7 a specific input range on which to test for duplicate data. */
8
9 Address Rxpipe
10
11 'pipe (endchar ?)',
12 '< &installdrive:\&installpath\examples\input\nyse.txt',
13 /* Format the date and time fields. */,
14 '| specs 7-8 1 \/\ n 5-6 n \/\ n 1-4 n 10-11 nw \:\ n 12-13 n \:\ n 14-15 n ws \;\ w2-* nw',
15 /* Format the data columns. */,
16 '| specs ws / ;/',
17 'w1-2 1',
18 'w3 nw.5 right',
19 'w4 nw.5 right',
20 'w5 nw.5 right',
21 'w6 nw.5 right',
22 'w7 nw.5 right',
23 '| a: unique count w3-* collapse', /* Collapse duplicates. */
24 '| b: faninany', /* Read from both streams. */
25 '| cons', /* Display the result on the console. */
26 '?',
27 'a:',
28 '| specs /---/ 1 1-* strip nw /duplicate ---/ nw', /* Create the duplicate output message. */
29 '| b:'
30
31 Say 'Hit Enter to close..'
32 Parse Pull
33
34 Exit 0
**** End of file ****
|