I may be missing the point Dave, why can't you open foo.csv in Libreoffice calc, sort by column 3, the frequency column. Move the header back to the top? Easier than trying to understand a Script.
Ken
On 03/23/2016 08:23 AM, Knight, Dave wrote:
My point exactly, thanks!
There are many good reasons to sort channels.
Periodically, I download the channels to CHIRP for editing (it's easier than on the HT) sorting** and printing, then upload the reorganized channels to the HT.
FWIW, I wrote the following (bash shell script) to sort CHIRP-exported .csv files by repeater frequency:
#!/bin/bash # # sortBaofeng - sorts chirp .csv file by frequency (field 3) and renumbers # the lines (filed 1) for import. # # FWIW, by clicking on the column name, CHIRP sorts the rows by that column, # but does not renumber the rows. # if [ "x$1" = "x" ] then echo "Usage: $0 <chirp_csv_filename>" echo " Sorts rows by frequency and renumbers them for CHIRP import." echo " The sorted and renumbered lines are written to stdout." exit 1 fi
IFN=$1 sort --field-separator=, -k3n,3 < $IFN | gawk -F, ' BEGIN{OFS=","} $1 != "Location"{$1 = ++n} {print $0 }'
and use it thus:
1 - download radio channels to CHIRP 2 - edit to add/remove channels as necessary 3 - export to foo.csv 4 - run the script (sortByFreq) on the .csv file:
sortByFreq foo.csv > new.csv
5 - print new.csv 6 - import new.csv into CHIRP 7 - upload channels to radio
To modify the script to sort by another column, change the "3"s in the key (-kn3,3) to the number of the .csv column you want.
Steps 3 - 6 of this convoluted, external-to-chirp process would be obviated if CHIRP supported options to print, save and upload the channels after sorting.
Until then, I hope the above script & process might be useful to other CHIRP users.
On Wed, Mar 23, 2016 at 7:52 AM, Fred Maxwell <_chirp@mail2fm.com mailto:_chirp@mail2fm.com> wrote:
> On Mar 23, 2016, at 6:09 AM, Jim Unroe <rock.unroe@gmail.com <mailto:rock.unroe@gmail.com>> wrote: > > On Tue, Mar 22, 2016 at 7:04 PM, Knight, Dave <diemkae@gmail.com <mailto:diemkae@gmail.com>> wrote: >> After clicking on a column heading to sort the chirp entries, the new sort >> order is lost on upload or save. >> >> Please advise how I can save/upload sorted rows. > > Which column are you sorting by? What would be the reason that you > what the channel rows not to be in the same order that they are in the > radio? > What I believe that Dave wants is the ability to lock the memory location column order and sort everything else so as to reorder how the channels that will be programmed into the radio. I’ll join in saying that would be a good feature. A user with dozens of repeaters might want them to be programmed into the radio sorted by repeater Name for easy location (clockwise rotation of the ‘channel' knob steps through alphabetically). Or someone with a dual-band, or tri-band radio might want them sorted by frequency so that the bands are separated into memory blocks. Or someone might want to group all of the entries by Duplex to separate out repeaters from simplex frequencies. In my case, I sort by distance from my home — the higher the memory location number, the further from my home base station (and CHIRP does not support RepeaterBook queries by proximity; issue 3261). That forces me into a tedious off-line process involving two RepeaterBook queries, one in CHIRP format CSV and one in native RepeaterBook CSV, and then going through contortions in a spreadsheet. I won’t go into detail and turn this into a threadjacking, but it’s another example of how one might want to sort. Hope that was of some assistance in explaining what was wanted. (Dave, if I screwed anything up, please let me know.) Regards, Fred KM4QLB _______________________________________________ chirp_users mailing list chirp_users@intrepid.danplanet.com <mailto:chirp_users@intrepid.danplanet.com> http://intrepid.danplanet.com/mailman/listinfo/chirp_users This message was sent to Dave Knight at diemkae@gmail.com <mailto:diemkae@gmail.com> To unsubscribe, send an email to chirp_users-unsubscribe@intrepid.danplanet.com <mailto:chirp_users-unsubscribe@intrepid.danplanet.com>
-- The "Safe in Church" deception: believing that calling some building a "sanctuary" will magically deter criminal violence is a dangerous delusion!
The "Gun-Free Zone" deception: believing that a "No Guns" policy or sign will deter criminal violence is "magical thinking" in its most dangerous form!
In your time of need, may your piece be with you!
chirp_users mailing list chirp_users@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_users This message was sent to Ken at ken@wa0sbu.com To unsubscribe, send an email to chirp_users-unsubscribe@intrepid.danplanet.com