I have a file like this:
Name Position Letter String
Bla 123 A ..B.,,,.C..
Bla 123 B ..a.,,,.C..
Bla 123 C ..b.,,,.A..
I would like to replace the . and , with Letter (in the first line it’s A)
The end product:
Name Position Letter String
Bla 123 A AABAAAAACAA
Bla 123 B BBaBBBBBCBB
Bla 123 C CCbCCCCCACC
The awk thinking is replace character in column 4 with “the” character in column 3.
I think awk should be the correct tool for this but I´m stuck with replacing character in string.
sed s/\(^.\{4\}\)./\\{3\}/ didn’t work and I think sed may be the wrong tool.
Awk/sed/python/perl/vi solutions welcomed.
See it