I have records in list.txt (INPUT) asList of animals SET 1=Dog 2=Crow 3=Snake Pet,bird,reptileList of Countries SET 1=France 2=Singapore 3=Columbia Europe,Asia,SouthAmericaList of Parts SET 1=KeyBoard 2=Speaker 3=LEDpanel Computer,AudioPlayer,TelevisionList of Cities SET 1=Amsterdam 2=KualLumpur 3=Paris Netherlands,Malaysia,FranceWant the last column of each line to be used as array for replacing the numbers 1,2,3For eg. Use Pet,bird,reptile of first line to make Pet=Dog bird=Crow and reptile=Snake.So, the OUTPUT file would beList of animals SET Pet=Dog bird=Crow reptile=SnakeList of Countries SET Europe=France Asia=Singapore SouthAmerica=ColumbiaList of Parts SET Computer=KeyBoard AudioPlayer=Speaker Television=LEDpanelList of Cities SET Netherlands=Amsterdam Malaysia=KualLumpur France=ParisUsing awk, I could split the last column as string of array.But unable to use the same to replace the numbers 1,2,3.
Loop through array
text processing;awk