Some users may need to sort the files that are being imported. This article was created to show how to sort a file.
Intersection Magic has the ability to import files that use several record lines to record a single crash. Intersection Magic requires multi-line files be grouped contiguously (one following the next) and in the correct order. An import file with one vehicle record per line would need to be grouped by cased id, and ordered by vehicle record. Without the lines of a crash record being grouped together Intersection Magic would treat each records as changes to the original crash record line that was imported, and without the correct order Intersection Magic would import based only on the order of each record in the file.
Windows allows files to be sorted with a dos sort command. The sort command can group lines of a text file together. To use the sort command open a dos command window and enter the sort command to sort your file.
sort (file to be sorted) /o (name of the sorted file) /+ (number of characters on each line to begin the comparison)
In the following examples we will use a file named test.txt in the c:temp directory. Test.txt file will contain the following lines:
A command of: sort c:/temp/Test.txt /o c:/temp/results01.txt
will create a results01.txt file with the following lines:
A command of: sort c:/temp/Test.txt /o c:/temp/results02.txt /+18
will create a results02.txt file with the following lines:
In this example the sort command ignored the first 18 characters on each line during the sort.
Depending on your import file two sort operations may be required. One sort to group the crash records together, and an additional sort to order the vehicle records.