Scanning a line for a code - then using that code to update the related line.
Posted: Tue Mar 09, 2021 12:24 am
Hi All,
I'm currently evaluating Textpipe Pro to see if it is able to solve an issue I currently have.
I have some text files with two distinct sections, each section has a set of lines of text which are related to each other via an 'entry number'. I need to take an extract of text from one of the lines from the first section and append it to the end of the corresponding line (with the matching 'entry number') in the second section.
Here's a simplified example:
U-005X;GLASGOW INTL;LIMO,CF-LIMOREF1/VNO6000/PICK UP TIME:0900;
U-002X;GLASGOW INTL;FERRY,CF-FERRYREF1/VNO7733/DEPARTURE TIME:1100;
U-003X;GLASGOW INTL;TAXI,CF-TAXIREF1/VNO7418/PICK UP TIME:1000;
RM*MS/PC5/SG02/PALL
RM*MS/PC11/SG03
RM*MS/PC11/SG05
In the above example, I need the the pick up/departure time in the first section appended to the corresponding line in the second section. The two sections are linked via the 'entry number' which is the bold underlined number above.
So far I've managed to work out the following:
I'm currently evaluating Textpipe Pro to see if it is able to solve an issue I currently have.
I have some text files with two distinct sections, each section has a set of lines of text which are related to each other via an 'entry number'. I need to take an extract of text from one of the lines from the first section and append it to the end of the corresponding line (with the matching 'entry number') in the second section.
Here's a simplified example:
U-005X;GLASGOW INTL;LIMO,CF-LIMOREF1/VNO6000/PICK UP TIME:0900;
U-002X;GLASGOW INTL;FERRY,CF-FERRYREF1/VNO7733/DEPARTURE TIME:1100;
U-003X;GLASGOW INTL;TAXI,CF-TAXIREF1/VNO7418/PICK UP TIME:1000;
RM*MS/PC5/SG02/PALL
RM*MS/PC11/SG03
RM*MS/PC11/SG05
In the above example, I need the the pick up/departure time in the first section appended to the corresponding line in the second section. The two sections are linked via the 'entry number' which is the bold underlined number above.
So far I've managed to work out the following:
- Extracted the Entry Number into @SegNum using Regex.
- Extracted the Time into @Time using regex.
- Cut @SegNum down from three characters to two characters to match the second section.
- Use @SegNum in a regex match.