摘要: 001、 [root@pc1 test01]# cat a.txt A:10 B:5 C:12 [root@pc1 test01]# cat b.txt 100 A 50 B 88 K 99 Y 42 C [root@pc1 test01]# awk '{if(NR == FNR) {ay[$1] 阅读全文
posted @ 2023-09-08 13:48 小鲨鱼2018 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 001、 正确做法 [root@pc1 test01]# ls a.txt b.txt [root@pc1 test01]# cat a.txt A:10 B:5 C:12 [root@pc1 test01]# cat b.txt 100 A 50 B 42 C [root@pc1 test01]# 阅读全文
posted @ 2023-09-08 13:25 小鲨鱼2018 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 001、 方法1 [root@pc1 test01]# ls a.txt b.txt [root@pc1 test01]# cat a.txt A:10 B:5 C:12 [root@pc1 test01]# cat b.txt 100 A 50 B 42 C [root@pc1 test01]# 阅读全文
posted @ 2023-09-08 12:44 小鲨鱼2018 阅读(1059) 评论(0) 推荐(0) 编辑
摘要: 001、 -F 指定 [root@pc1 test01]# ls a.txt [root@pc1 test01]# cat a.txt a:b:c 3:8:k f:6:3 [root@pc1 test01]# awk -F ":" '{print $1}' a.txt a 3 f 002、-v FS 阅读全文
posted @ 2023-09-08 12:28 小鲨鱼2018 阅读(78) 评论(0) 推荐(0) 编辑