Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Extract a column of data from a text file (part 2)

45179902
8 - Asteroid

This question is similar to Solved: Extract the last two values from rows in text file... - Alteryx Community

 

A text file includes data like this:

ISP-123456    2    C    2   2

ASI-123213    A    3    1    5

PSI-123233    A    2    3    7

SRI-213232          1    4    9

SIR-122323    1    2   24   0

TIS-123980    C    B         1

BSI-231897    1    3     8   T

 

Suppose that I always want to extract the values from column 4 ( 2, 1, 3, 4, 24, 8 ) if there is a value in that column. How do I achieve this?

2 REPLIES 2
apathetichell
20 - Arcturus

if regex_match([test],"^.*\s(\d+)(\s.*$)") then
regex_replace([test],"^.*\s(\d+)(\s.*$)","$1",0) else null() endif

 

works with your sample data - in a formula tool. This assumes that the second to last row should be a null and any entries that don't have a number in the fourth position should be nulls.

atcodedog05
22 - Nova
22 - Nova

Hi @45179902 

 

Here is the updated workflow.

 

atcodedog05_0-1642572203977.png

 

Hope this helps : )

 

Labels
Top Solution Authors