awk - How to extract common words from two files where one contains a PL/SQL block while the other is a list of functions used - in UNIX? -
i have file input_sql in unix.
the file looks :
yifi.yifi_bdcr_process_ log @bhor.ab.ctt.com
group vdr_date;
raise_application_error (-20004, 'pqi_sector_daily_v1 data not available. record_cnt ' || record_cnt);
from rtb.s_rtb3_gsm_usid_dy@maxima_m62085_lnk.db.att.com
raise_application_error (-20004, 's_btb4_gsm_usid_dy data not available. record_cnt ' || record_cnt);
,nvl(a.useid, b.useid) useid
and cm_usid <> 'unassigned';
prompt updating process table log
delete cqi_imp_metric_process_log
insert cqi_imp_metric_process_log
trunc(sysdate),
sysdate,
i have file b having text like:
insert
log
group by
nvl
trunc
sysdate
log
ln
sign
i wish extract common words between 2 files (select, insert etc.) in unix.
the output should in third file c:
group by
||
||
trunc
nvl
trunc
sysdate
trunc
sysdate
thanks :)
ps : using solution given, log, sign, ln getting included in third file coming cqi_imp_metric_process_log, , cm_usid <> 'unassigned'; @maxima_m62085_lnk.db.att.com respectively. not wish include these texts.
here awk
awk 'fnr==nr {a[$0];next} {for (i in a) if (tolower($0)~tolower(i)) print}' pattern filea **insert /*+append */ abc_imp_sec_daily_stg select
gnu awk
version:
awk -vignorecase=1 'fnr==nr {a[$0];next} {for (i in a) if ($0~i) print}' pattern filea **insert /*+append */ abc_imp_sec_daily_stg select
Comments
Post a Comment