Thursday, January 1, 2015

Exporting Radio ID's from Unitrunker

Happy New Year!

I still have to complete my GPS series, but for now I am changing gears for a bit and going to post how to easily export Radio ID's from Unitrunker, so you can easily cut and paste them into Uniden Sentinel or GREComm software.  In my 2nd part to this, I will show you a way to update your Sentinel favorite lists without the hassle of cutting and pasting.

First a warning, unless you are somewhat familiar with Linux, this probably isn't going to be for you.  2nd, before attempting anything like this, BACK UP EVERYTHING.  I would go so far to back up your files, move them to another computer if you have one, and make sure they work there.  I am not responsible if you make a mess of your stuff.

Unitrunker is a great problem, and for keeping a watch on a trunk system, it is invaluable.  You can alpha tag all the talkgroups and radio id's and keep watch for new users and/or new talkgroups.  Where it falls short is that it does not really give you an easy way to export the data into something usable.  You can load up the unitrunker file in excel and do the manipulation there, however it is messing and time consuming.

It is very simple to export the radio ID"s out.  My method requires you to have access to a linux bash shell.  This means either a PC with linux on it, running it in a virutal machine, or you can install cygwin (https://www.cygwin.com) and do everything from there.

First step is to copy your Unitrunker.xml file over to a working directory.  Before you do, you should hit the "X" on the main unitrunker screen.  It will say it saved the data and ask you if you want to quit.  We do this to make sure all the updated data has been saved.

Since I have cygwin on the computer that runs unitrunker, I do this:
cp "/cygdrive/c/Users/John/AppData/Roaming/UniTrunker/Unitrunker.xml" .

Next we want to pull out only the Radio ID's
grep User Unitrunker.out > uni.out

Which leaves you a file with a bunch of lines that resemble this:
<User id="9681" label="Troop Car 2212P" color="00FF00" lockout="0" rank="50" group="53296" first="20140318174455" last="20140718182323" hits="11" voice="1" mask="1" logon="2" />

Next we issue this command to grab only user ID and Label, it also will move label to the left for easier import into Home Patrol.

paste <(cut -d "\"" -f 4 uni.out) <(cut -d "\"" -f 2 uni.out) > uni1.out

Finally, more often than not, there are a bunch of radio id's that have not been identified or alpha tagged yet, you won't want to import those, so we issue this command to ignore those, and create the text file:
grep -Ev '00FF00' uni1.out > 700ids.txt

You now have a text file that you can load into excel and  cut and paste into Sentinel or the GRE program.  That User id entry above now looks like this:
Troop Car 2212P 9681 (There is actually a delimiter between 2212P and 9681)

One final caveat to this, if you have several systems in your Unitrunker file, you will have to isolate the system before pulling out the radio id's, otherwise you will wind up with a file with all the id's from all your systems in your Unitrunker setup.  By looking for a unique pattern (The system ID is usually a good one), you can do this this the sed command:

Cuts from the top of the file to a pattern match:
sed -n '/pattern/q;p' old_file > new_file

Cuts from a pattern match to the bottom of the file:
sed -n '/pattern/,$p' old_file > new_file

You can combine the 2 commands above if you have a bunch of systems and the one you want is in the middle.

As you can see, this is very specific to how each person has things setup, so there really is no way to come up with a universal setup.

The next segment will show how I take apart a Home Patrol favorite list, and re-assemble it with an updated ID list.







No comments:

Post a Comment