"vbscript"查找行具有用冒号分隔的相似单词" : "



我有一个文本文件包含5000多行,每行有两个单词,用冒号分隔 eg( word1:word2 (我需要一个脚本将每行上的 (word1( 与 (word2( 进行比较,如果它们完全匹配,它将该行保存在新的文本文件中。提前感谢您的帮助

只需将输入文件拖放到此批处理脚本上,您将获得一个由冒号分隔的相同单词的新文件:

@echo off
Mode 70,3 & color 0A
Title Find lines have the similar words separated by a colon
set "ScriptName=%~nx0"
if "%~1"=="" goto error
echo(
echo      Find lines have the similar words separated by a colon
Set "OutputFile=newfile.txt"
If exist "%OutputFile%" Del "%OutputFile%"
for /f "tokens=1,2 delims=:" %%a in ('Type %1') do (
    If [%%a]==[%%b] echo %%a:%%b
)>>"%OutputFile%"
Start "" "%OutputFile%" & Exit
::****************************************************************
:Error
Mode 70,5 & color 0C
echo( & echo(
echo      You should drag and drop your file over "%ScriptName%"
Timeout /T 5 /nobreak>nul & exit
::****************************************************************

相关内容

  • 没有找到相关文章

最新更新