- 论坛徽章:
- 0
|
本帖最后由 sundful 于 2011-10-17 11:25 编辑
有两个文件,分别是文件A和文件B,格式如下:
A:- 13811111111
- 13911111111
- 15011111111
- 13822222222
- 13922222222
- 15022222222
复制代码 B:- 211.138.100.173 - - 2011-09-01 00:00:36 "GET /space/friendspace/layout.action?friendUserId=166467966&tp=space HTTP/1.0" 200 8497 "-"
- "10.214.56.178" "SonyEricssonK700c/R2AE SEMC-Browser/4.0.3 Profile/MIDP-2.0 Configuration/CLDC-1.1" "-" "8615011111111" "HTTP/1.1 S
- XTY-PS-WAP-GW11 (infoX-WISG, Huawei Technologies)" "-"
- 218.202.106.201 - - 2011-09-01 00:00:36 "GET /im/chat/toinputMsg.action?touserid=707610079&backUrl=&t=42969748415091570&tp=space HTT
- P/1.1" 200 7325 "-" "10.162.219.141" "Maui Browser" "-" "8613811111111" "ZXWAP GateWay,ZTE Technologies" "-"
- 211.137.199.53 - - 2011-09-01 00:00:36 "POST /im/chat/sendMsg.action?touserid=653598235&tp=space HTTP/1.0" 200 1421 "-" "10.152.41.2
- 47" "MX8/1.00 Nucleus RTOS/V1.11.19 MTK6225/07B Release/04.25.2008 Browser/Teleca Profile/MIDP-2.0 Configuration/CLDC-1.0" "-" "8615
- 022222222" "HTTP/1.1 SDJN-PS-WAP2-GW16 (infoX-WISG, Huawei Technologies)" "-"
- 211.136.115.45 - - 2011-09-01 00:00:36 "GET /space/giftbags/applystep2.action HTTP/1.0" 200 969 "-" "10.142.172.97" "MOT-A3000_CMCC/
- 1.0 Release/09.09.2008 Profile/MIDP-2.0 Configuration/CLDC-1.1 Software/WM6.1 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)" "-"
- "8613822222222" "HTTP/1.1 SHSH-PS-WAP2-GW19 (infoX-WISG, Huawei Technologies)" "-"
复制代码 现在想通过A的手机号,去匹配B文件里的手机号,如果B文件里包含了这个手机号,则输出手机的ua(user agent),想写个awk,传入两个参数,如:./mytj.sh a.txt b.txt
然后把手机对应的user agent 输出到另外一个文件中:
结果如下:- 13811111111 Maui Browser
- 15011111111 SonyEricssonK700c/R2AE SEMC-Browser/4.0.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
- 15022222222 MX8/1.00 Nucleus RTOS/V1.11.19 MTK6225/07B Release/04.25.2008 Browser/Teleca Profile/MIDP-2.0 Configuration/CLDC-1.0
- 13822222222 MOT-A3000_CMCC/
- 1.0 Release/09.09.2008 Profile/MIDP-2.0 Configuration/CLDC-1.1 Software/WM6.1 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)
复制代码 麻烦大侠帮我看看!· |
|