雨
分类: Python/Ruby
2011-03-31 14:49:16
原始文件
- # cat file4
- 05766798607
- 05766798608
- 05766798609
- # cat file3
- 10/05766798607,11/20050325191329,29/0.1,14/05766798607
- 10/05767158557,11/20050325191329,29/0.08,14/05767158557
预期结果
- 10/05766798607,11/20050325191329,29/0.1,14/05766798607
命令
- # grep -f file4 file3
- # awk -F'[/,]' 'ARGIND==1{a[$0]}ARGIND>1{if ($2 in a) print $0}' file4 file3
- # awk -F'[/,]' 'NR==FNR{a[$0]}NR>FNR{if ($2 in a) print $0}' file4 file3