To search and replace between line1 and line2 use following:
(*) This is vi editor command:
following command will serach and replace whole file. (this is default with %s).
:line1,$ s/old_string/new_string/g
following command will search and replace only in specific lines:
:line1,line2 s/old_string/new_string/g
for example,
:3,5 s/CIF/UOC/g
above command will replace CIF with UOC in lines 3,4 and 5.