#!/usr/bin/perl

# re-number [connections] section in wcx_ftp.ini file 

$/="[";

foreach my $sec (<>) {
    unless ($sec =~ /^connections\]\s*/i) {
        #warn "Leaving alone: '", substr($sec,0,20), "...'\n";
        print $sec;
        next;
    }

    my $c = 1;
    foreach (split /\n/, $sec) {
        if ( s/^\d*=(.*)/$c=$1/s ) { $c++ };
        print "$_\n";
    }
}

