removing-a-block-of-records.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: startup.ini and removes the first [TCPIP] section.
3 The FROMLABEL stages are used to select the beginning and ending records of the section
4 that we want to remove. */
5
6 Address Rxpipe
7
8 'pipe (endchar ? reg 1)',
9 '< &installdrive:\&installpath\examples\input\startup.ini',
10 '| take 23',
11 '| a: fromlabel casei() /[tcpip]/', /* Select records starting with the TCPIP label. */
12 '| drop 1', /* Discard the label record. */
13 '| fromlabel reg /^\[.*/', /* Start reading records again from the next label. */
14 '| b: faninany', /* Combine the streams. */
15 '| cons', /* Display on the console. */
16 '?',
17 'a:',
18 '| take *', /* Unselected records from FROMLABEL stage. */
19 '| b:' /* Route them back to main pipeline. */
20
21 Say 'Hit Enter to close..'
22 Parse Pull
23
24 Exit 0
**** End of file ****
Console
output |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
1 [FILES]
2 Order=ba
3 a=d:\file a1.txt
4 b=d:\file b3.txt
5
6 [SPOOL]
7 Header=2e
8 State=0a
9
10 [FILES1]
11 Order=ba
12 a=d:\file a9.txt
13 b=d:\file b2.txt
14
15 [TCPIP1]
16 ID=20
17 Path=C:\Program Files
18 Vers=2.0
19 Hit Enter to close..
|