#!/bin/bash #Check if the syntax is right if [ $# -ne 3 ];then echo "Check your syntax" exit 1 fi #1st flag is the input file, the 2nd is the output and the 3rd is the array name awk -F ";" 'BEGIN{ printf("int %s [] = {",$1) ar[1]="0370" ar[2]="0387" ar[3]="0371" ar[4]="0372" ar[5]="0373" ar[6]="0388" ar[7]="0374" ar[8]="0395" ar[9]="0301" ar[10]="0389" ar[11]="0397" ar[12]="0301" ar[13]="038A" ar[14]="0399" ar[15]="0301" ar[16]="038B" ar[17]="0375" ar[18]="038C" ar[19]="039F" ar[20]="0301" ar[21]="038D" ar[22]="038E" ar[23]="0376" ar[24]="03A5" ar[25]="0301" ar[26]="038F" ar[27]="0377" ar[28]="03A9" ar[29]="0301" ar[30]="0390" ar[31]="03CA" ar[32]="0301" ar[33]="037A" ar[34]="0391" ar[35]="0392" ar[36]="0345" ar[37]="0393" ar[38]="0345" ar[39]="0394" ar[40]="037B" ar[41]="037C" ar[42]="0395" ar[43]="0396" ar[44]="037D" ar[45]="0397" ar[46]="0398" ar[47]="0399" ar[48]="037E" ar[49]="039A" ar[50]="039B" ar[51]="039C" ar[52]="039D" ar[53]="039E" ar[54]="039F" ar[55]="03A0" ar[56]="0384" ar[57]="03A1" ar[58]="03A2" ar[59]="030D" ar[60]="03A3" ar[61]="0301" ar[62]="0385" ar[63]="0301" ar[64]="03A4" ar[65]="03A5" ar[66]="03A6" ar[67]="0386" ar[68]="03A7" ar[69]="0391" ar[70]="0301" ar[71]="03A8" ar[72]="03A9" }{ flag=0 for(i=1; i<=72; i++){ if(ar[i]==$1){ flag=1 } } if(/LETTER/ || flag==1 ){ print $1", 1,"}else{ print $1", 0,"} } ' $1 > $2 exit 0