Home > Blockchain >  Search and replace timestamps and GPS data with regex in Notepad
Search and replace timestamps and GPS data with regex in Notepad

Time:02-16

I have log files with some lines containing GPS data, which I need to filter:

[2022-02-15 15:50:20.551] [user01] ID: 1 long: 18.03580993572624, lat: 59.29910442961695, heading: 309.700000

[2022-02-15 15:51:10.545] [user02] ID: 2 long: 18.03580232322323, lat: 59.29910441212122, heading: 23.40000

And I need to extract the coordinates, time, and user so convert them into this CSV format:

2022-02-15 15:50:20.551, user01, 59.29910442961695, 18.03580993572624

2022-02-15 15:51:10.545, user02, 59.29910441212122, 18.03580232322323

How can I do this?

CodePudding user response:

You may try the following find and replace, in regex mode:

Find:    ^\[(.*?)\] \[(.*?)\] ID: \d  long: (\d (?:\.\d )?), lat: (\d (?:\.\d )?), heading: \d (?:\.\d )?$
Replace: $1, $2, $4, $3

Demo

  • Related