<commit_before># AWK Script to parse the MCC-MNC table obtained from: http://www.itu.int/pub/T-SP-E.212B-2011
# -> You should export the table to TXT file from FreeOffice ;)
# (c) Telefonica Digital, 2012 - All rights reserved
# <NAME> <frsela at tid dot es>

# Use: awk -f load_mcc_mnc_onmongo.awk mcc_mnc_list.txt

function mongo(cmd) {
  if(execute_mongo == 1) {
    command = "mongo push_notification_server --quiet --eval \"" cmd "\""
    debug("[DB] " command)
    system(command)
  } else {
    printf("%s\n", cmd)
  }
}

function debug(msg) {
  if(debug_enabled == 1) {
    printf(" * %s\n", msg)
  }
}

BEGIN {
  debug_enabled = 0
  execute_mongo = 1   # Execute mongo command or only print into screen

  printf("MCC & MNC import tool for the Telefonica Digital notification server\n")
  printf("(c) Telefonica Digital, 2012 - All rights reserved\n\n")
  FS = "\t"
  mongo("db.operators.drop()")
  complete_line = 0
  operators_count = 0
}

{
  # Skip first 5 lines
  if(NR <= 5) {
    debug("Skipping line " NR)
    next
  }

  if($1 != "") {
    country = $1 $2 $3 $4 $5
    sub("'", "\\'", country)
  }
  if($2 != "") {
    if($2+0 != $2) {
      operator = $1 $2 $3 $4 $5
      sub("'", "\\'", operator)
    } else {
      mcc = $2
    }
  }
  if($3 != "" && $3+0 == $3) {
    mnc = $3
    complete_line = 1
  }<commit_msg>OWD 29976.  Handle the right number of digits of MCC/MNC in all cases<commit_after># AWK Script to parse the MCC-MNC table obtained from: http://www.itu.int/pub/T-SP-E.212B-2011
# -> You should export the table to TXT file from FreeOffice ;)
# (c) Telefonica Digital, 2012 - All rights reserved
# <NAME> <frsela at tid dot es>

# Use: awk -f load_mcc_mnc_onmongo.awk mcc_mnc_list.txt

function mongo(cmd) {
  if(execute_mongo == 1) {
    command = "mongo push_notification_server --quiet --eval \"" cmd "\""
    debug("[DB] " command)
    system(command)
  } else {
    printf("%s\n", cmd)
  }
}

function debug(msg) {
  if(debug_enabled == 1) {
    printf(" * %s\n", msg)
  }
}

BEGIN {
  debug_enabled = 0
  execute_mongo = 1   # Execute mongo command or only print into screen

  printf("MCC & MNC import tool for the Telefonica Digital notification server\n")
  printf("(c) Telefonica Digital, 2012 - All rights reserved\n\n")
  FS = "\t"
  mongo("db.operators.drop()")
  complete_line = 0
  operators_count = 0
}

{
  # Skip first 5 lines
  if(NR <= 5) {
    debug("Skipping line " NR)
    next
  }

  if($1 != "") {
    country = $1 $2 $3 $4 $5
    sub("'", "\\'", country)
  }
  if($2 != "") {
    if($2+0 != $2) {
      operator = $1 $2 $3 $4 $5
      sub("'", "\\'", operator)
    } else {
      mcc = $2
    }
  }
  if($3 != "" && $3+0 == $3) {
    mnc = sprintf("%03d", $3)
    complete_line = 1
  }
{'fraction_non_alphanumeric': 0.16891153986166726, 'fraction_numerical': 0.035311248634874406, 'mean_word_length': 2.6688918558077437, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2114718', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1056, 'n_words': 291}