Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete line in text file and sort by date
#1
Hi ,
here again to ask your help.
I have a file named "FIRST.TXT" with about 20000 lines.
The original file have this structure (first line of data start after <eoh> and each line separated by <eor>

ADIF Export
<adif_ver:5>3.1.1
<created_timestamp:15>20210622 131000
<programid:6>WSJT-X
<programversion:5>2.4.0
<eoh>
<call:5>WA1TY <gridsquare:4>EM45 <mode:3>FT8 <rst_sent:3>+34 <rst_rcvd:3>+11 <qso_date:8>20210622 <time_on:6>131000 <qso_date_off:8>20210622 <time_off:6>131000 <band:3>15m <freq:9>21.091650 <station_callsign:5>W1WWW <my_gridsquare:4>EM21 <operator:5>w1www <eor>
<call:5>WA2TY <gridsquare:4>EM45 <mode:3>FT8 <rst_sent:3>+32 <rst_rcvd:3>+11 <qso_date:8>20210621 <time_on:6>111230 <qso_date_off:8>20210621 <time_off:6>111230 <band:3>15m <freq:9>21.091650 <station_callsign:5>W1WWW <my_gridsquare:4>EM21 <operator:5>w1www <eor>
<call:5>AA3TY <gridsquare:4>EM45 <mode:3>FT8 <rst_sent:3>+31 <rst_rcvd:3>+11 <qso_date:8>20210621 <time_on:6>101430 <qso_date_off:8>20210621 <time_off:6>101430 <band:3>15m <freq:9>21.091650 <station_callsign:5>W1WWW <my_gridsquare:4>EM21 <operator:5>w1www <eor>
<call:5>AD4TY <gridsquare:4>EM45 <mode:3>FT8 <rst_sent:3>+33 <rst_rcvd:3>+13 <qso_date:8>20210619 <time_on:6>131700 <qso_date_off:8>20210619 <time_off:6>131700 <band:3>15m <freq:9>21.091650 <station_callsign:5>W1WWW <my_gridsquare:4>EM21 <operator:5>w1www <eor>
<call:5>NN5TY <gridsquare:4>EM45 <mode:3>FT8 <rst_sent:3>+32 <rst_rcvd:3>+12 <qso_date:8>20210622 <time_on:6>131900 <qso_date_off:8>20210622 <time_off:6>131900 <band:3>15m <freq:9>21.091650 <station_callsign:5>W1WWW <my_gridsquare:4>EM21 <operator:5>w1www <eor>

FIRST QUESTION:

I must delete these lines in the title and create file SECOND.TXT
<adif_ver:5>3.1.1
<created_timestamp:15>20210622 131000
<programid:6>WSJT-X
<programversion:5>2.4.0

I do it with this macro:
str s.getfile("C:\Users\User\Desktop\LOG\first.txt")
s.findreplace("<ADIF_VER:5>3.1.1" "")
s.findreplace("<created_timestamp:15>20210622 131000" "")
s.findreplace("<programid:6>WSJT-X" "")
s.findreplace("<programversion:5>2.4.0" "")
out s
s.setfile("C:\Users\User\Desktop\LOG\second.txt")

Finally I have the words deleted but not the line.
What's the command for delete the line ? 
This is the actually resolt:

ADIF Export




<eoh>
<call:5>IK1TY <gridsquare:4>JN45 <mode:3>FT8 <rst_sent:3>+34 <rst_rcvd:3>+11 <qso_date:8>20210622 <time_on:6>131000 <qso_date_off:8>20210622 <time_off:6>131000 <band:3>15m <freq:9>21.091650 <station_callsign:5>W1WWW

As you see there is space between ADIF Export and <eoh> ..... I would like to not have this space with empty lines.
I'm looking for any command but I don't find it !

SECONDO QUESTION

Any help for a macro for index by date and time each <eoh> field and create a new file listed by date and time ?... The date and time are those following the <qso_date:8> entry and the <time_off:6> entry.

.... Hope to have a reply as soon as possible .... I start learning step by step but your help is primary !

Thank you !!!!


Messages In This Thread
Delete line in text file and sort by date - by asgro - 10-31-2021, 07:09 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)