record_1
conversion of a file;
code change;
data types;
lenght;
end;
record_2
field name;
string;
new fileline;
end;
record_3
address;
street;
zipcode;
state;
end;
file2.txt
record_2
field name;
string;
new fileline;
category;
decimal type;
end;
i want the output be like this in file1.txt
file1.txt
record_1
conversion of a file;
code change;
data types;
lenght;
end;
record_2
field name;
string;
new fileline;
category;
decimal type;
end;
record_3
address;
street;
zipcode;
state;
end;
i want to search for the record_2 pattern in file1 and using file2, if it exist i want to replace the whole line from record_2 to end; with the file2 content in file1. always my search pattern should replace lines between record_? through end; with second file.
please help me to solve this by using shell scripting.
a) Does it work on your system with the sample given?
b) Does your real file comply to that structure?
c) Up to which record count DOES it work?
d) see post#6
Now My output should be like out :: conv_c1_t0(in) = from file1 and updated function of out :: conv_c1_t1(in) = from file 2 as it contains one extra field :
include "~$XFR/conv.xfr";
/*C1_T0*/
out :: conv_c1_t0(in) =
begin
out.field1 ::decimal_lpad(in..efgh);
out.country2 :: in.country.sub_country;
out.cur :: if(!is_defined(in.tran.ghjk) || is_blank(string_lrtrim(in.tran.ghjk)))
string_lpad(" ",6)
else
string_repad(in.tran.ghjk,6);
end;
/*C1_T1*/
out :: conv_c1_t1(in) =
begin
out.test ::decimal_lpad(in..test1);
out.zipcode :: in.state.state1;
out.pin :: in.country.state;
out.adr :: in.adr1.adr2;
out.date :: if(!is_defined(in.temp.date1) || is_blank(string_lrtrim(in.temp.date1)))
string_lpad(" ",6)
else
string_repad(in.temp.date1,6);
end;
Note : File 2 we are generating in our script dynamically.