有关awk文件关联问题

发布于 2022-09-02 00:13:37 字数 6326 浏览 10 评论 1

tabclums.txt 内容如下:
tp_monitor_val_manager|start_date|
tp_monitor_val_manager|end_date|
settle_catalog_array_temporary|start_date|
tp_hcode_bak|start_date|
tp_hcode_bak|end_date|
table_operation_log|deal_datetime|
flux_monitor_instance|sampling_date|
tp_discount_temporary|discount_date|
tp_discount_temporary|start_time|
tp_discount_temporary|end_time|
tp_discount_temporary|start_date|
tp_discount_temporary|end_date|
tp_discount|discount_date|
tp_discount|start_time|
tp_discount|end_time|
tp_discount|start_date|
tp_discount|end_date|
tp_dz_hcode|start_datetime|
tp_dz_hcode|end_datetime|
tp_card_rate_part|start_date|
tp_card_rate_part|end_date|
tp_iden_office|start_date|
tp_iden_office|end_date|
tp_iden_call_happen_area|start_date|
tp_iden_call_happen_area|end_date|
tp_icp_rule|start_datetime|
tp_icp_rule|end_datetime|
tp_iden_settle_logic|adjust_time|
tp_iden_office_temporary|start_date|
tp_iden_office_temporary|end_date|
tp_hcode_temporary|start_date|
tp_hcode_temporary|end_date|
tp_hcode|start_date|
tp_hcode|end_date|
tp_gaoe_def|start_datetime|
tp_gaoe_def|end_datetime|
tpz_iden_settle_type|start_datetime|
tpz_iden_settle_type|end_datetime|
tpz_rate_cell|start_datetime|
tpz_rate_cell|end_datetime|
tp_163_config|validate_rule1|
tp_163_config|validate_rule2|
tp_special_phone_temporary|start_date|
tp_special_phone_temporary|end_date|
tp_special_phone|start_date|
tp_special_phone|end_date|
tp_toll_ratio_temporary|start_date|
tp_toll_ratio_temporary|end_date|
tp_toll_ratio|start_date|
tp_toll_ratio|end_date|
work_log|log_time|
web_report|create_date|
tp_trunk_temporary|start_date|
tp_trunk_temporary|end_date|
tp_trunk|start_date|
tp_trunk|end_date|
tp_settle_fee_gjj|start_date|
tp_settle_fee_gjj|end_date|
tp_one_year|one_date|
tp_phone_brand|start_date|
tp_phone_brand|end_date|
tp_phone_brand_temporary|start_date|
tp_phone_brand_temporary|end_date|
tp_local_ratio|start_date|
tp_local_ratio|end_date|
tp_inter_tsp_gaoe|start_datetime|
tp_inter_tsp_gaoe|end_datetime|
tp_local_ratio_temporary|start_date|
tp_local_ratio_temporary|end_date|
tp_national_800|valid_time|
tp_national_800|elapse_time|
tp_settle_cycle|start_date|
tp_settle_cycle|end_date|
tp_roam_msc|start_date|
tp_roam_msc|end_date|
product_def|eff_date|
product_def|exp_date|
product_offer|eff_date|
product_offer|exp_date|
flux_monitor_task|stat_last_date|
flux_monitor_task|update_frequency|
flux_monitor_task|update_last_date|
flux_monitor_task|update_deal_flag|
flux_monitor_task|update_product_id|
flux_monitor_task|start_date|
flux_monitor_task|end_date|
life_cycle|eff_date|
life_cycle|exp_date|
alarm|alarm_time|
alarm|process_time|
td_a_month|start_date|
td_a_month|end_date|
tg_task|stat_datetime|
tg_task|stat_last_date|
tg_task|start_date|
tg_task|end_date|
tpj_iden_rate|start_datetime|
tpj_iden_rate|end_datetime|
tpi_iden_settle_type|start_datetime|
tpi_iden_settle_type|end_datetime|
tpi_rate_cell|start_datetime|
tpi_rate_cell|end_datetime|
td_placard|log_time|
s_country_imsi|start_date|
s_country_imsi|end_date|
vpi_settle_type|start_datetime|
vpi_settle_type|end_datetime|
vp_trunk_in|start_date|
vp_trunk_in|end_date|
vp_trunk_out|start_date|
vp_trunk_out|end_date|
operator|valid_date|
operator|psw_mod_date|
tp_ctry|eff_date|
tp_ctry|exp_date|
tp_ctry|update_time|
tp_stt_object|eff_date|
tp_stt_object|exp_date|
tp_stt_object|update_time|
tp_iden_office_temporary_bak|start_date|
tp_iden_office_temporary_bak|end_date|
tp_mss_report_import|sett_date|
tp_settle_rule|start_date|
tp_settle_rule|end_date|
tp_settle_rule_temporary|start_date|
tp_settle_rule_temporary|end_date|
settle_catalog_array_temp|deal_date|
tp_hcode_static_bak|start_date|
tp_hcode_static_bak|end_date|

tabnum.txt内容如下:
alarm|0
flux_monitor_instance|110
flux_monitor_task|2
life_cycle|0
operator|3
product_def|118
product_offer|0
s_country_imsi|0
settle_catalog_array_temp|0
settle_catalog_array_temporary|56264
table_operation_log|1930985
td_a_month|121
td_placard|0
tg_task|15
tp_163_config|0
tp_card_rate_part|0
tp_ctry|249
tp_discount|91
tp_discount_temporary|91
tp_dz_hcode|0
tp_gaoe_def|338
tp_hcode|197690
tp_hcode_bak|174781
tp_hcode_static_bak|193013
tp_hcode_temporary|193013
tp_icp_rule|0
tp_iden_call_happen_area|0
tp_iden_office|53277
tp_iden_office_temporary|53277
tp_iden_office_temporary_bak|53162
tp_iden_settle_logic|9
tp_inter_tsp_gaoe|0
tp_local_ratio|40
tp_local_ratio_temporary|40
tp_monitor_val_manager|0
tp_mss_report_import|176
tp_national_800|16
tp_one_year|365
tp_phone_brand|280
tp_phone_brand_temporary|280
tp_roam_msc|0
tp_settle_cycle|336
tp_settle_fee_gjj|1545
tp_settle_rule|128
tp_settle_rule_temporary|128
tp_special_phone|247
tp_special_phone_temporary|247
tp_stt_object|585
tp_toll_ratio|34
tp_toll_ratio_temporary|34
tp_trunk|1010
tp_trunk_temporary|1010
tpi_iden_settle_type|26
tpi_rate_cell|3
tpj_iden_rate|8464
tpz_iden_settle_type|0
tpz_rate_cell|0
vp_trunk_in|887
vp_trunk_out|897
vpi_settle_type|26
web_report|552
work_log|2912
我想实现tabnum.txt第二个字段不为0时,输出tabclums.txt中的$1,$2的值。怎么用awk实现?
我写了如下语句关联不出来
awk -F| 'NR==FNR {a[$1]+=$2} NR>FNR&&a[$1]>0 {print $1,$2}' tabnum.txt  abclums.txt
请高手解答:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

活泼老夫 2022-09-02 00:32:45

居然没有人知道

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文