I Have a raw csv file as below
SVEIS , SVESID,SVETIME
Quneter,53553,01122003010005
renchure,37151,12092008011005
now I need to change the data from day month year to year day month as below
SVEIS , SVESID,SVETIME
Quneter,53553,2003-01-12 01:00:05
renchure,37151,2008-12-09 01:10:05
I need to change this using NIFI
I have used replace text processor but I am getting error like unable to process 10 of 10 records in nifi
3
Answers
We can start from a simple expression using quantifiers and capturing groups:
and replace it with:
where
$1-$7
are our groups with new desired format.DEMO
RegEx Circuit
jex.im visualizes regular expressions:
Demo
If
awk
can be used, this is possible to solve like this:While both of the existing answers explain how to accomplish this task using String parsing via regular expressions, those solutions will be fairly complicated to change if the incoming data changes in any way. The question is for Apache NiFi, and the solution is to treat the CSV data as records and use the
UpdateRecord
processor. This processor allows you to use RecordPath syntax to specify the field (column) you’re interested in and replace it with a new value, which can be static or determined via Expression Language. You can use the#toDate
and#format
methods to convert the string from the incoming format to the desired one (or simply insert the delimiters directly).There are good articles about using the RecordPath mechanics as well.