Hello,
I created a template [1] that shows an example of how to do the date
conversion you described. It is linked to from the main templates page on
the wiki [2] and is named "DateConversion.xml"
It first uses ExtractText to find the date string and extract it into an
attribute called "date". The regular expression used is: (\d{2}-\d{2}-\d{4}
\d{2}\.\d{2}\.\d{2})
Then it uses ReplaceText with the Search Value of the same regular
expression above, to replace that with ${date:toDate("dd-MM-yyyy
HH.mm.ss"):format("yyyy-MM-dd HH:mm:ss+0000")}
Hope that helps.
-Bryan
[1]
https://cwiki.apache.org/confluence/download/attachments/57904847/DateConversion.xml?version=2&modificationDate=1462288576652&api=v2
[2]
https://cwiki.apache.org/confluence/display/NIFI/Example+Dataflow+Templates
On Tue, May 3, 2016 at 8:37 AM, idioma <[email protected]> wrote:
> Hi,
> I am trying to make use of ReplaceText in order to match each each line of
> delimited values (.dsv files) whose format is: DD-MM-YYYY HH.MM.SS and
> replace it with YYYY-MM-DD HH:MM:SS+0000. I am not sure I have really
> understood how to use this out-of-the-box processor and I looked at various
> examples from
> https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
> ,
> but with no joy.
>
> I am not sure what to use in the Search value section and to test it I have
> included a concrete date:
>
> 26-02-2000 12.37.29
>
> Whereas my replacement value will be: ${time:format("yyyy/MM/dd
> HH:mm:ss.SSS'Z'")}
>
> My result is an empty value between the ¦ delimitor values. How can I
> capture a date in the format DD-MM-YYYY HH.MM.SS? What does it expect in
> the
> Replacement Value? I am using Replacement Strategy = Regex Replace and
> Evaluation Mode = Line-by-Line. Please advise, I think I am totally missing
> the point and making a rather trivial mistake.
>
> Thank you
>
>
>
> --
> View this message in context:
> http://apache-nifi-developer-list.39713.n7.nabble.com/ReplaceText-Usage-tp9792.html
> Sent from the Apache NiFi Developer List mailing list archive at
> Nabble.com.
>