shlogg · Early preview
Judy @esproc_spl

Converting Text Blocks Into Strings With EsProc

Problem: Convert text file blocks into strings. Solution: Use esProc script (p1.dfx) with @i import, A2 grouping & A3 export.

Problem description & analysis
Below is data in text file txt.txt:
this is
a
single record
 
here is the next record followed by a line with just a space
 
finally
our
last
record
We are trying to convert each block of data into a string as follows:
-> this is a single record
-> here is the next record followed by a line with just a space
-> finally our last record
Solution
Write the following p1.dfx in esProc:

Explanation:
A1   Import the txt data; @i enables returning the result set a sequence when it has only one column.
A2  Group A1’s data according to the condition that the previous memb...