免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3136 | 回复: 0
打印 上一主题 下一主题

有关awk文件关联问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-23 15:32 |只看该作者 |倒序浏览
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
请高手解答:
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP