Hello I have a file with repetitive data as such:
ENGLAND ENGLAND ENGLAND JAPAN JAPAN JAPAN JAPAN AMERICA AMERICA AMERICA
And a second file with unique data that has two columns(separated by “=” ), with the first column being considered a key:
ENGLAND=LONDON JAPAN=TOKYO AMERICA=WASHINGTON DC AUSTRALIA=SYDNEY IRELAND=DUBLIN
I am trying to figure out how I can output the second column of the second file using the first column as a matching key. The output should be:
LONDON LONDON LONDON TOKYO TOKYO TOKYO TOKYO WASHINGTON DC WASHINGTON DC WASHINGTON DC
I’ve tried using the first file as an array in bash and using cat on the second file piped into grep with the array as the search feature. The output didn’t equate to multiple instances of the array. I think there is a way with awk using arrays, but I haven’t been able to figure it out in the last few days.