I don't know my way around he file system, or what scritps can be run, so I stuck to the SQLite3 command line.
The below generates a channel list setup script that will restore the channel order when run from SQLite3.
The idea is it can be used to backup/restore your current channel order & manipulated to change the order.
NOTE: This procedure assumes you have already removed any duplicate channels
Save the following as a text file to /media/getChannels.sql (I used that directory as it's accessible on FTP/samba)
---------------
.mode column --sets the format of the output file
.width 26 4 15 30 5 25 --sets the widths for each column in characters
.output /media/channels.txt --specifies the file to write output to
select 'update tbl_svc set uslcn =' u, usLcn, ' where szsvcname= ''' w, szsvcname, '''; --' e, svcidx from tbl_svc order by usLcn;
--------------
At the SQLite3 command line type the following command to execute the commands in the file you just saved:
.read /media/getChannels.sql
This will output a script to /media/channels.txt containing all of your channels in current LCN order.
Example from my current list:
update tbl_svc set uslcn = 1 where szsvcname= 'BBC One HD' ; -- 4
update tbl_svc set uslcn = 2 where szsvcname= 'BBC TWO' ; -- 7
update tbl_svc set uslcn = 3 where szsvcname= 'ITV1 HD' ; -- 2
update tbl_svc set uslcn = 4 where szsvcname= 'ITV1 +1' ; -- 35
Take a couple of copies of this file to another machine keeping a copy as a backup and a separate one for any editing.
If for example you wanted to switch BBC1 and BBC2 around, you just switch the LCN's over in the file:
update tbl_svc set uslcn = 2 where szsvcname= 'BBC One HD' ; -- 4
update tbl_svc set uslcn = 1 where szsvcname= 'BBC TWO' ; -- 7
update tbl_svc set uslcn = 3 where szsvcname= 'ITV1 HD' ; -- 2
update tbl_svc set uslcn = 4 where szsvcname= 'ITV1 +1' ; -- 35
Then copy the altered file back into /media/ and jump back onto the SQLite3 console and type the following command to import the new channel order, then the exit and reboot commands:
.read /media/channels.txt
.exit
reboot
When the box comes back, your channel order should be just how you want it.
Usual disclaimers apply, but I've not had any problems & the backup copy should let you revert to the original list if needed.