找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 13659|回复: 4

请求删除此帖,废弃无用了请求删除此帖,废弃无用了

  [复制链接]
发表于 2022-4-15 18:59:21 | 显示全部楼层 |阅读模式
本帖最后由 cl2039996 于 2022-5-8 16:30 编辑

请求删除此帖,废弃无用了请求删除此帖,废弃无用了请求删除此帖,废弃无用了请求删除此帖,废弃无用了
发表于 2022-4-15 19:56:48 | 显示全部楼层
本帖最后由 went 于 2022-4-15 20:09 编辑

密码went
test.bat 保存utf-8编码
  1. @echo off & cd /d "%~dp0"
  2. setlocal enabledelayedexpansion
  3. chcp 65001 & cls
  4. set "dir_txt=Youdict优词英语词源词典(21230条).txt"
  5. (
  6.         for /f "usebackq delims=" %%i in ("%dir_txt%") do (
  7.                 if "!last!"=="中文词源" echo %%i
  8.                 set "last=%%i"
  9.         )
  10. )>"chinese.txt"
  11. pause&exit
复制代码
发表于 2022-4-15 21:01:16 | 显示全部楼层
  1. <# :
  2. cls&echo off&cd /d "%~dp0"&rem bat存为ANSI/GB2312编码
  3. powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal "%~f0"|out-string|Invoke-Expression"
  4. pause
  5. exit
  6. #>
  7. $oldfile="Youdict优词英语词源词典(21230条).txt";
  8. $newfile="结果.txt";
  9. if(-not (test-path -literal $oldfile)){write-host ('"'+$oldfile+'" 未找到');exit;}
  10. [System.Collections.ArrayList]$s=@();
  11. $enc=New-Object System.Text.UTF8Encoding $False;
  12. $text=[IO.File]::ReadAllLines($oldfile, $enc);
  13. for($i=0;$I -lt $text.length;$i++){
  14.     $line=$text[$i].trim();
  15.     if($line -eq '中文词源'){
  16.         $word=$text[$i-1].trim();
  17.         $detail=$text[$i+1].trim();
  18.         if($detail -notmatch '^[a-z]'){$detail=$word+' '+$detail;}
  19.         [void]$s.add($detail);
  20.     }
  21. }
  22. [IO.File]::WriteAllLines($newfile, $s, $enc);
复制代码
 楼主| 发表于 2022-4-15 21:23:39 | 显示全部楼层
回复 2# went


    已经给您转过去了,20元,辛苦
 楼主| 发表于 2022-4-15 21:24:56 | 显示全部楼层
回复 3# zaqmlp


    您好,Went大佬先完成的,我感谢您也热心帮忙。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 04:07 , Processed in 0.014842 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表