[ad_1]
this command will give the required result
awk -F’: *’ -v OFS=”: ” ‘$1==”replace”{r=$2;print;next}r{$1=r;r=””}7’ file
[ad_2]
solved find the second word in first line which starts with specific word and replace the next line first word in linux