BEGIN { counter = 0; # 0 origin printf("/* generated by ctlwords.awk. do not edit by hand. */\n"); } /^\/\*CTL\*\// { word = substr($0, index($0, "CTL_")); word = substr(word, 0, index(word, ",") - 1); printf("#define\t%s\t%d\n", word, counter++); }