add_user_to_subscriber_list.awk 749 Bytes
Newer Older
Raphael Defosseux's avatar
Raphael Defosseux committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
BEGIN{lineIdx=0}
{
    captureLine[lineIdx] = $0
    lineIdx = lineIdx + 1
    print $0
}
END{
   for (ueIdx = 1; ueIdx < num_ues; ueIdx++) {
       for (k = 0; k < lineIdx; k++) {
           if (captureLine[k] ~/UserName=/) {
               mLine = captureLine[k]
               MSIN=sprintf("%08d", 1111+int(ueIdx))
               gsub("00001111", MSIN, mLine)
               print mLine
           } else {
               if (captureLine[k] ~/SubscriptionIndex/) {
                   mLine = captureLine[k]
                   MSIN=sprintf("%d", 111+int(ueIdx))
                   gsub("111", MSIN, mLine)
                   print mLine
               } else {
                   print captureLine[k]
               }
           }
       }
   }
}