标签:awk处理合并
##### awk处理合并行 场景1:
aa.txt
101 aa
102 bb
bb.txt
101 111
102 222
cat aa.txt bb.txt |sort -n -k1|awk ‘NR%2==1{fd1=$2"\t"$3;next}{print $0"\t"fd1}‘
101 aa 111
102 bb 222
##### awk 处理合并行 场景2:
cat aa.txt
1891,1892,1893 = 2017-10-23 14:54:16
1895,1896 = 2017-10-23 14:54:21
1897 = 2017-10-23 14:54:22
awk -F‘=‘ ‘{split($1,arr,","); for(i in arr){ print arr[i],$2 }}‘ aa.txt
1891 2017-10-23 14:54:16
1892 2017-10-23 14:54:16
1893 2017-10-23 14:54:16
1895 2017-10-23 14:54:21
1896 2017-10-23 14:54:21
1897 2017-10-23 14:54:22
本文出自 “开发与运维” 博客,谢绝转载!
标签:awk处理合并
原文地址:http://yeqing.blog.51cto.com/3159086/1975454