0

如果可能,我需要知道如何使用 notepad++、freecommander 和 windows 等工具对文本文件执行高级搜索。一个 bat 脚本文件会很棒。

问题是我需要在一个目录中搜索大约 1000 个 txt 文件。我需要知道这 1000 个 txt 文件的形式,这些文件具有例如“SYR_SHA/245/4”形式的字符串。我只想让它搜索模式,例如可以改变数字的字符*****_******/*****/******在哪里。*

_如上例所示,第一组和第二组字符之间必须有一个。该脚本应该遍历整个 txt 文件并搜索上述模式。然后脚本应该将所有结果移动到一个单独的目录中

非常感谢

4

1 回答 1

0

Create this batch file and copy it into your folder where you have all the 1000 .txt files

Change the yourdestinationdirectory directory and run the batch file

@Echo Off
FindStr /M /R "[a-zA-Z]*_[a-zA-Z]*\/[0-9]*\/[0-9]*" *.Txt > findstr.out
For /F "tokens=*" %%a In (FindStr.out) Do call :move_Rtns %%a
del FindStr.out
Exit /B

:move_rtns
copy %1 yourdestinationdirectory\*
del /Q %1
Exit /B

Please change the Regex according to your requirement, for eg. If you are expecting number and letter together you can replace [a-zA-z] with [a-zA-Z0-9]

Good luck

于 2013-02-21T18:02:11.153 回答