Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
prees959
Creator II
Creator II

Extract field values & DateTime

HI,  Im reading some log files where each row starts as a datetime and an IP address:

 

Screenshot 2020-07-17 at 09.25.51.png

Can someone advise please on how to split the field into the following data items :

Screenshot 2020-07-17 at 09.31.14.png

 

Many thanks!

 

Phil

Labels (3)
1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

see attached

hope this helps

View solution in original post

3 Replies
Frank_Hartmann
Master II
Master II

see attached

hope this helps

Taoufiq_Zarra

One solution :

Data:

load Date(TimeStamp#(replace(subfield(A,']',1),'[',''),'YYYYMMDD hh:mm:ss')) as Date,
Time(TimeStamp#(replace(subfield(A,']',1),'[',''),'YYYYMMDD hh:mm:ss')) as Time,
replace(subfield(A,']',2),'[','') as IP,
subfield(A,']',3) as DESC

FROM
.\Downloads\dsds.xlsx
(ooxml, explicit labels, table is Feuil1);

 

Input:

Capture.PNG

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

Assuming that you have same format of the other values. You can do below

If format of the time in string is different then you need to provide same format in timestamp# function.

Data:
Load *,
     date(floor(timestamp#(TextBetween(Field,'[',']'),'YYYYMMDD hh:mm:ss')),'DD/MM/YYYY') as Date,
     time(timestamp#(TextBetween(Field,'[',']'),'YYYYMMDD hh:mm:ss')) as Time,
     TextBetween(Field,'[',']',2) as IP,
     SubField(Field,']',-1) as DESC
Inline "
Field
[20200303 14:00:00] [86.245.198.170] southern stores 588872 "