I have two files with FILE1 containing lots of lines and FILE2 with KEY VALUE parms. I need to compare FILE2 with FILE1 and if there is match the corresponding word in FILE1 should be replace with next column in FILE2.
Example:
FILE1:
<SOME YAML CODE
-------------->
PARM1
PARM2
PARM3
PARM4
<END OF YAML CODE
---------------->
FILE2:
PARM1 mmddyy
PARM2 hhmmss
PARM3 awsid
PARM4 cc
So for every match from FILE2 in FILE1, the corresponding word in FILE1 should be replace with 2nd column in FILE2. So the desired output should like:
<SOME YAML CODE
-------------->
mmddyy
hhmmss
awsid
cc
<END OF YAML CODE
---------------->
I tried using sed with limited knowledge but not achieving the desired output.
Appreciate your time and support
PARM1
anywhere in the YAML code? As part of another word? As a random string? And can thePARM
appear as the second or third or Nth word on a line or will it always be the first? Can there be other words on the same line? – terdon Sep 17 '21 at 15:41