Board logo

标题: [文本处理] [已解决]求批处理根据a文件内容提取b文件内容 [打印本页]

作者: pdang    时间: 2013-5-12 15:40     标题: [已解决]求批处理根据a文件内容提取b文件内容

a.txt内
  1. KB2670838   
  2. KB2592687   
  3. KB2476490   
  4. KB2479943   
  5. KB2484033   
  6. KB2488113   
  7. KB2491683   
  8. KB2492386   
  9. KB2503658   
  10. KB2505438   
  11. KB2506014   
  12. KB2506212   
  13. KB2506928   
  14. KB2508429   
  15. KB2509553   
  16. KB2511250   
  17. KB2511455   
  18. KB2515325   
  19. KB2522422   
  20. KB2529073  
  21. ..............N行
复制代码
b.txt文件内容如下
  1. http://download.windowsupdate.com/msdownload/update/software/secu/2011/01/windows6.1-kb2475792-x64_2e8f675625883458482042e128f54167f0193f9b.msu
  2. http://download.windowsupdate.com/msdownload/update/software/secu/2011/01/windows6.1-kb2425227-x64_0749e0e8531479e1de9347fe584e61d43c209c0f.msu
  3. http://download.windowsupdate.com/msdownload/update/software/secu/2011/01/windows6.1-kb2485376-x64_7082a10a94b6cfffdd28f5f57f02e15a5345f5a7.msu
  4. http://download.windowsupdate.com/msdownload/update/software/secu/2011/01/windows6.1-kb2479628-x64_a774713ef62d45373a08d4a7c0acfa18e8ec87c8.msu
  5. http://download.windowsupdate.com/msdownload/update/software/secu/2011/01/windows6.1-kb2482017-x64_95006a2b965e8566d8a57600a0c0c53cb7212874.msu
  6. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2506212-x64_d23437b7902566fdc1ab3c972f38b3370a1f25a3.msu
  7. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2446710-x64_2df983290aec7bc15bcdf02722004c299e57c3b0.msu
  8. http://download.windowsupdate.com/msdownload/update/software/updt/2011/03/windows6.1-kb2511250-x64_460c30edb3e4257720b2fd96dc1e297b5912e29a.msu
  9. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2506223-x64_aa2472e1a5ca513ad87ee48bb666cff02474b30e.msu
  10. http://download.windowsupdate.com/msdownload/update/software/updt/2011/04/windows6.1-kb2492386-x64_c3ae664fc97ac46fc51d4b67dcad3b40b860af55.msu
  11. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2491683-x64_f33cff50cf92e0b8c0043f1ef3587661d600633e.msu
  12. http://download.windowsupdate.com/msdownload/update/software/crup/2011/03/windows6.1-kb2506014-x64_cc70f2accbfbae5e68f3c7aa3dba8877d1dc88a7.msu
  13. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2507618-x64_59ebfe1068e7e82a6eb74c2df33a6769af6dbbab.msu
  14. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2508272-x64_809a19099da4f25de9a33c233765d3969c0c6202.msu
  15. http://download.windowsupdate.com/msdownload/update/software/updt/2011/03/windows6.1-kb2505438-x64_068d9d60e103c9044b186c5dd3d9f5da9c9ead98.msu
  16. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2503658-x64_bbabf3cd4b9426b3ff04ee43c6a610ad91f35d4d.msu
  17. http://download.windowsupdate.com/msdownload/update/software/updt/2011/04/windows6.1-kb2506928-v2-x64_54e2c3d6b32d9ec399c2c4ace6f19018690156bd.msu
  18. http://download.windowsupdate.com/msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_0ba5ac38d4e1c9588a1e53ad390d23c1e4ecd04d.msu
  19. http://download.windowsupdate.com/msdownload/update/software/crup/2011/03/windows6.1-kb2524375-x64_9293ad5e0fed616819818169518bef00c6219272.msu
  20. http://download.windowsupdate.com/msdownload/update/software/secu/2011/01/windows6.1-kb2479943-x64_2a683f1c9acb8b3c1fb480c1ff07a275267030ec.msu
  21. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2497640-x64_963f55e45c86cd263e7260e52691a749458ce49f.msu
  22. http://download.windowsupdate.com/msdownload/update/software/secu/2011/03/windows6.1-kb2509553-x64_48517ee2bd09479ad2d04c03e00f9b1460996469.msu
  23. ..................N行
复制代码
也就是b.txt内含有a.txt里的内容
提取到的内容输入到c.txt
作者: xxpinqz    时间: 2013-5-12 16:49

  1. @echo off
  2. (for /f "tokens=*" %%a in (a.txt) do echo %%~nxa)>$
  3. findstr /ig:$ b.txt >c.txt
  4. del $&start c.txt
复制代码

作者: pdang    时间: 2013-5-12 16:55

非常感谢xxpinqz  问题解决  抽空多向你学习批处理




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2