Adding column at the end to pipe delimited file in NiFi

Viewed 199

I have this particular pipe delimited file in a SFTP server

PROPERTY_ID|START_DATE|END_DATE|CAPACITY
1|01-JAN-07|31-DEC-30|101
2|01-JAN-07|31-DEC-30|202
3|01-JAN-07|31-DEC-30|151
4|01-JAN-07|31-DEC-30|162
5|01-JAN-07|31-DEC-30|224

I need to transfer this data to S3 bucket using NiFi. In this process I need to add another column which is today's date at the end.

PROPERTY_ID|START_DATE|END_DATE|CAPACITY|AS_OF_DATE
1|01-JAN-07|31-DEC-30|101|20-10-2020
2|01-JAN-07|31-DEC-30|202|20-10-2020
3|01-JAN-07|31-DEC-30|151|20-10-2020
4|01-JAN-07|31-DEC-30|162|20-10-2020
5|01-JAN-07|31-DEC-30|224|20-10-2020

what is the simple way to implement this in NiFi?

1 Answers

@Naga here is a very similar post that describes the ways to solve adding a new column on CSV:

Apache NiFi: Add column to csv using mapped values

The simplest way is ReplaceText to append the same "|20-10-2020" to each line. ReplaceText settings will be evaluate line by line and Regex: $1|20-10-2020. The other methods are additional ways to do that more dynamically, for example if the date isnt static.

Related