11-12-2019 06:33 AM
Good day community.
I have a CSV file, see attached, which I would like to pick up the last three fields from the right as their own fields, and the rest of the record/line as a “value” field.
sampleData.txt (80 Bytes)
So basically, the output should be
[value] [row] [pipeID] [date]
where is the remainder of the data in the row.
Is this possible?
Thanks
Solved! Go to Solution.
11-13-2019 11:17 AM
Hi Philliperamos,
I created a pipeline that will keep the last 3 columns as it is and the rest of the row values will be concatenated under the value field.
Here I am attaching pipeline and sample data file.
Hope this is what you are required.
Dynamic_csv_column_change_2019_11_14.slp (10.3 KB)
sample.txt (231 Bytes)
11-13-2019 11:17 AM
Hi Philliperamos,
I created a pipeline that will keep the last 3 columns as it is and the rest of the row values will be concatenated under the value field.
Here I am attaching pipeline and sample data file.
Hope this is what you are required.
Dynamic_csv_column_change_2019_11_14.slp (10.3 KB)
sample.txt (231 Bytes)
11-13-2019 11:32 AM
@nsingam Thanks for this.
I forgot to mention that the number of columns can change.
So one file could have 10 columns, another file could have 7, but the last 3 columns would always be ROW, PIPEID and DATE.
Hence why I wanted to be able to read from right to left.
11-13-2019 11:36 AM
@philliperamos, I am not hardcoded anything in that pipeline. It will work for any no of columns in your CSV file. If for any reason the last 3 columns are different than ROW, PIPEID, DATE then those new columns will be keep as it is and these columns will come under value.
11-13-2019 11:44 AM
Ok great! Thanks!
I’ll test it with various files with different column amounts and let you know!