well wat ya can do is this have it not a txt but an ini like this

[Server1]
#channel1
#channel2
[Server2]
#channel3
#channel4

then have part of ur script to read the ini
var %server watever server u want
var %a = $read(serversandchans.ini,w, * $+ [ $+ %server $+ ] $+ *)
and then have a while down the list till u get to the nexe[server]