Let A,B,C,D are the words
Input File :
.. A/B/C/D W/B/C/Z L/B/C/O ..
.. A/B/C/A W/B/C/W L/B/C/L ..
word D with
word A one the same line, only if
/B/C/ delimiter present in the line and like wise for the other lines
sed/awk/perl oneliner to accomplish that