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