(very new to coding in general. Starting with BATCH file.)
I have the following main file I use for some aviation data:
Documents\DATA\LIVE\sector.txt
[AIRPORT]
UT12 (coordinates)
U42 (coordinates)
SLC (coordinates)
;APTEND
[VOR]
BIL (coordinates)
TCH (coordinates)
VEL (coordinates)
;VOREND
Every so often, there are updates to this data and those updates are stored in individual text files like so:
Documents\DATA\PREVIEW\AIRPORT.txt
[AIRPORT]
BZN (coordinates)
6S8 (coordinates)
GTF (coordinates)
and...
Documents\DATA\PREVIEW\VOR.txt
[VOR]
LWT (coordinates)
TCH (coordinates)
DTA (coordinates)
I am trying to figure out how to create a batch file that would search sector.txt for the different strings of data [AIRPORT} to ;APTEND and then replace the contents with the contents of the file in the Preview folder.
The category heads [AIRPORT] and [VOR] never change but the data below it does including the number of lines of data, and that is where I am stuck.
The following code won't work because it is not a single line or element that I am looking to replace, but rather a group of data that changes all the time.
powershell -Command "(gc myFile.txt) -replace 'foo', 'bar' | Out-File myFile.txt"
Points in the right direction would be appreciated! Thanks!