"vbscript" 查找具有由冒号“:”分隔的相似词的行
"vbscript" find lines have the similar words separated by the colon " : "
我有一个包含 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
::****************************************************************
我有一个包含 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
::****************************************************************