Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort data in txt file by date and time
#1
Here I am with a new request for help.
I have a txt file in Desktop directory named ARCHIVIO.TXT with the following data :

<DATE:8>20190313 <TIME:6>221015 <ID:2>MY <RX:3>MTS ....(follow are data in the same line)
<DATE:8>20190314 <TIME:6>081030 <ID:2>MY <RX:2>MT ....(follow are data in the same line)
<DATE:8>20190312 <TIME:6>121015 <ID:2>MY <RX:3>MTH ....(follow are data in the same line)
<DATE:8>20190312 <TIME:6>000000 <ID:2>MY <RX:4>MTGF ....(follow are data in the same line)
<DATE:8>20190312 <TIME:6>121016 <ID:2>MY <RX:3>SSH ....(follow are data in the same line
<DATE:8>20190315 <TIME:6>000020 <ID:2>MY <RX:3>ARB ....(follow are data in the same line)
<DATE:8>20190310 <TIME:6>001030 <ID:2>MY <RX:3>MTR ....(follow are data in the same line)
<DATE:8>20190314 <TIME:6>000020 <ID:2>MY <RX:3>MTH ....(follow are data in the same line)
( follow others lines )

I need to obtein a new file (named PERSONAL.TXT) with DATE and TIME in descending order (from oldest to most recent)

<DATE:8>20190310 <TIME:6>001030 <ID:2>MY <RX:3>MTR ....(follow others data in the same line)
<DATE:8>20190312 <TIME:6>000000 <ID:2>MY <RX:4>MTGF ....(follow others data in the same line)
<DATE:8>20190312 <TIME:6>121015 <ID:2>MY <RX:3>MTH ....(follow others data in the same line)
<DATE:8>20190312 <TIME:6>121016 <ID:2>MY <RX:3>SSH ....(follow others data in the same line
<DATE:8>20190313 <TIME:6>221015 <ID:2>MY <RX:3>MTS ....(follow others data in the same line)
<DATE:8>20190314 <TIME:6>000020 <ID:2>MY <RX:3>MTH ....(follow are data in the same line)
<DATE:8>20190314 <TIME:6>081030 <ID:2>MY <RX:2>MT ......(follow others data in the same line)
<DATE:8>20190315 <TIME:6>000020 <ID:2>MY <RX:3>ARB ....(follow others data in the same line)
( follow others lines )

Note: The number after DATE it's mean the number of the digit of the date (YYYYMMDD).
The number after TIME it's mean the number of the digit of the time (HHMMSS).
These numbers for these fields are alway the same ( 8 for DATE and 6 for TIME ).

Actually I convert the TXT file to CSV format and using Excel I can arrange a descending order.
After I convert again in txt format.

Surely there is a simple way using QM !

Can I get help? ... I tried to search the forum but I didn't find anything like it.

Thanks a lot !


Messages In This Thread
Sort data in txt file by date and time - by asgro - 04-26-2019, 01:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)