I would like to ask for help as this is beyond my knowledge. I`m trying to do a search and replace between 2 files. So far I have written a code that isolates all specific strings TerminationDate* from file one. But to search for its replacement in another file and return the string located 2 lines below its first match is a black hole for me.
Files to work with:
- containing filtered data to be processed further by searching for strings within this file and replace them from the 2nd file;
- huge file to be looked for the strings from the 1st file;
- containing the filtered strings only from the 1st file sorted in one column;
Goal is to have strings from the 3rd file replaced from the 2nd one and rewrite the 1st file with these new data. So for example this string TerminationDate1 will be replaced with the date 2015/05/25 in file 1.
The first file looks like this:
config vdom
edit vdom_1
config firewall policy
edit 123
set uuid xxxxxxxxxxxxxxx
set srcintf "xxxxx"
set dstintf "xxxxx"
set srcaddr "xxxxx"
set dstaddr "xxxxx"
set action accept
set schedule "TerminationDate1" <---
set service "xxx"
set logtraffic all
set comments "xxxxx"
and so on
part of the 2nd file like this:
config firewall schedule onetime
edit "TerminationDate1"
set start 12:01 2014/04/24
set end 12:01 2015/05/25
set color 0
set expiration-days 4
and so on
and the last one I have created as temporary one containing so far jut one column with filtered results. Maybe the 2nd column could contain corresponding strings from the 2nd file.
TerminationDate1
TerminationDate2
TerminationDate3
and so on