复制代码
- @echo off
- ::by cjiabing&from http://hi.baidu.com/cjiabing/home
- title 批处理版中英文词典 V1.1
- ::本工具基于现代汉语词典、中国成语大辞典、现代汉语词典、牛津英汉词典、牛津高阶英汉词典、成语词典等词典,用以综合查询字词,仅供学习和研究用。
- ::以前写的,较为简单,有空再升级。
- echo ◇建议在最大化模式下运行◇ ◇建议在最大化模式下运行◇
- goto start1
- ◇◆●○
- :start
- cls
- echo.
- echo.
- echo ● 中英文词典查询工具 ●
- echo.
- echo ○ 1 普通查询【M1】 ○ 2 单字查询【M2】
- echo ○ 3 全文搜索【M3】 ○ 4 词头匹配【M4】
- echo ○ 5 成语词典【M5】 ○ 6 英文词典【M6】
- echo ○ 7 牛津高阶英汉词典【M7】 ○ 8 综合查询【M8】
- echo ________________________________________________________________________________
- echo.
- echo ◇ 1、本工具用于多个词典文本搜索,词典本身来自互联网,仅供学习研究。
- echo ◇ 4、可搜索汉字、成语和英语单词。推荐普通查询【M1】和综合查询【M8】。
- echo ◇ 2、为了得到更好的查询结果,请精细化、具体化搜索条件。
- echo ◇ 3、查询结果保存在文本“_FResults.txt”中,可进行二次搜索和导出。
- echo ◇ 5、可以调整窗口大小:常规【N1】中等【N2】大屏幕【N3】
- echo ________________________________________________________________________________
- echo.
- set /p xz= ★ 请选择:
- cls
- for /l %%a in (1,1,8) do if %xz%==%%a goto start%%a
- set inf=%xz%
- call :menu0
- goto start
- :menu0
- if %inf%==N1 MODE con: COLS=85 LINES=25&goto :eof
- if %inf%==N2 MODE con: COLS=105 LINES=57&goto :eof
- if %inf%==N3 MODE con: COLS=125 LINES=90&goto :eof
- for /l %%a in (1,1,8) do if %inf%==M%%a goto start%%a
- goto :eof
- :start1
- COLOR 97
- echo.
- echo.
- echo ◆ 普通查询 ◆
- echo.
- set /p inf= ★ 待查字词(菜单 【M】;在结果中查询 SEC):
- if %inf%==M goto start
- call :menu0
- if %inf%==SEC call :sec1&goto start1
- echo ____________________________________________________________________________________________________
- findstr /i /a:2c /n ""*%inf%"" 现代汉语词典.txt
- echo.
- findstr /i /a:2c /n "【%inf%" 现代汉语词典.txt
- echo.
- findstr /b /i /a:2c /n "%inf%" 牛津英汉词典.txt
- echo.
- findstr /i /a:2c /n "【%inf%】" 中国成语大辞典.txt
- cd.>_FResults.txt
- findstr /i /a:2c /n ""*%inf%"" 现代汉语词典.txt>>_FResults.txt
- findstr /i /a:2c /n "【%inf%" 现代汉语词典.txt>>_FResults.txt
- findstr /b /i /a:2c /n "%inf%" 牛津英汉词典.txt>>_FResults.txt
- findstr /i /a:2c /n "【%inf%】" 中国成语大辞典.txt>>_FResults.txt
- echo ____________________________________________________________________________________________________
- echo ○ 查询结果保存在文本“_FResults.txt”中。
- goto start1
- :sec1
- echo.
- echo.
- echo ◇ 在结果中进行第二次搜索 ◇
- echo.
- set /p infs= ★ 待查字词(菜单 【M】):
- if %inf%==M goto start
- call :menu0
- echo ____________________________________________________________________________________________________
- cd.>_查询结果.txt
- if exist _FResults.txt findstr /i "%infs%" _FResults.txt>>_查询结果.txt
- type _查询结果.txt
- start "" _查询结果.txt
- echo ____________________________________________________________________________________________________
- echo ○ 查询结果保存在文本“_查询结果.txt”中。
- goto :eof
- :start2
- echo.
- echo ◆ 单字查询 ◆
- echo.
- set /p inf= ★ 待查字词(菜单 【M】):
- if %inf%==M goto start
- call :menu0
- echo ____________________________________________________________________________________________________
- findstr /i ""*%inf%"" 现代汉语词典.txt
- echo.
- findstr /i "【%inf%】" 现代汉语词典.txt
- echo.
- findstr /i "%inf%" 牛津英汉词典.txt
- echo ____________________________________________________________________________________________________
- goto start2
- :start3
- echo.
- echo ◆ 全文搜索 ◆
- echo.
- set /p inf= ★ 待查字词(菜单 【M】;在结果中查询 SEC):
- if %inf%==M goto start
- call :menu0
- if %inf%==SEC call :sec1&goto start3
- echo ____________________________________________________________________________________________________
- if exist _FResults.txt echo.>_FResults.txt
- findstr /i "%inf%" 现代汉语词典.txt>>_FResults.txt
- findstr /i "%inf%" 牛津高阶英汉词典.txt>>_FResults.txt
- findstr /i "%inf%" 中国成语大辞典.txt>>_FResults.txt
- type _FResults.txt
- echo ____________________________________________________________________________________________________
- echo ○ 查询结果保存在文本“_FResults.txt”中。
- goto start3
- :start4
- echo.
- echo ◆ 词头匹配 ◆
- echo.
- set /p inf= ★ 待查字词(菜单 【M】):
- if %inf%==M goto start
- call :menu0
- echo ____________________________________________________________________________________________________
- findstr /i /b "*%inf%" 现代汉语词典.txt
- findstr /i /b "%inf%" 牛津英汉词典.txt
- echo ____________________________________________________________________________________________________
- goto start4
- :start5
- echo.
- echo ◆ 成语查询 ◆
- echo.
- set /p inf= ★ 输入需要查询的成语(菜单 【M】):
- if %inf%==M goto start
- call :menu0
- echo ____________________________________________________________________________________________________
- findstr /i ""*%inf%"" 现代汉语词典.txt
- echo.
- findstr /i "【%inf%】" 现代汉语词典.txt
- echo.
- findstr /i "%inf%" 成语字典.txt
- echo.
- findstr /i "【%inf%】" 中国成语大辞典.txt
- echo ____________________________________________________________________________________________________
- goto start5
- :start6
- echo.
- echo ◆ 英汉词典 ◆
- echo.
- set /p inf= ★ 输入需要查询的单词(菜单 【M】):
- if %inf%==M goto start
- call :menu0
- echo ____________________________________________________________________________________________________
- findstr /i "%inf%" 牛津英汉词典.txt
- echo ____________________________________________________________________________________________________
- goto start6
- :start7
- echo.
- echo ◆ 牛津高阶英汉词典 ◆
- echo.
- set /p inf= ★ 输入需要查询的单词(菜单 【M】;全文搜索 ALL):
- if %inf%==M goto start
- call :menu0
- if %inf%==ALL goto start77
- echo ____________________________________________________________________________________________________
- findstr /i /b "%inf%" 牛津高阶英汉词典.txt
- echo ____________________________________________________________________________________________________
- goto start7
- :start77
- echo.
- echo ◇ 牛津高阶英汉词典全文搜索 ◇
- echo.
- set /p inf= ★ 待查字词(菜单 【M】;在结果中查询 SEC;返回 BACK):
- if %inf%==M goto start
- call :menu0
- if %inf%==BACK goto start7
- if %inf%==SEC call :sec1&goto start77
- echo ____________________________________________________________________________________________________
- if exist _FResults.txt echo.>_FResults.txt
- findstr /i "%inf%" 牛津高阶英汉词典.txt>>_FResults.txt
- type _FResults.txt
- echo ____________________________________________________________________________________________________
- echo ○ 查询结果保存在文本“_FResults.txt”中。
- goto start77
- :start8
- echo.
- echo ◇ 综合查询 ◇
- echo.
- echo. 【请将TXT格式的文本文件(其他词典)与本程序放到同一目录下使用】
- echo. 【请注意修改TXT词典的编码方式,有些特殊符号无法搜索】
- echo.
- echo.
- set /p inf= ★ 待查字词(菜单 【M】;在结果中查询 SEC;返回 BACK):
- if %inf%==M goto start
- call :menu0
- if %inf%==BACK goto start8
- if %inf%==SEC call :sec1&goto start77
- echo ____________________________________________________________________________________________________
- if exist _FResults.txt echo.>_FResults.txt
- for /f "tokens=*" %%a in ('dir /b') do if /i not %%~nxa=="_FResults.txt" findstr /i /a:2c /n "%inf%" %%a
- for /f "tokens=*" %%a in ('dir /b') do if /i not %%~nxa=="_FResults.txt" findstr /i /a:2c /n "%inf%" %%a>>_FResults.txt
- ::type _FResults.txt
- echo ____________________________________________________________________________________________________
- echo ○ 查询结果保存在文本“_FResults.txt”中。
- goto start77
复制代码
- curl -s http://dict.cn/ws.php?q=test | sed -n "/^<def>/,/<\/def>$/p"
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |