findFile
来源:互联网 发布:js 遍历dom元素集合 编辑:程序博客网 时间:2024/06/10 17:22
findFile查找包含字符串的文件,并列出该字符串在该文件所在的列。
第一参数:要查找的字符串。第二参数:查找字符串的文件。支持正规表达是。
注1:系统的find命令并不会在子目录中查找,而findFile会在子目录中查找
注2:findFile只会列出包含字符串的文件,而系统的find命令还会列出没有包含字符串的文件。比如:---------- 1.TXT。
使用实例
实例1:
findFile "hubin" *.txt
源码文件findFile.bat如下:
set fileName=%2
set temp=%0~temp.txt
set string=%string:"=%
if not defined string (
goto popvar
)
if not defined fileName (
set fileName=*
)
if exist %temp% (
del %temp% /q
)
FOR /F "delims=" %%i IN ('dir %fileName% /s/b/a:-d') DO (
find /n "%string%" "%%i">>%temp%
)
FOR /F "usebackq tokens=1,* delims= " %%i IN (%temp%) DO (
if "%%i" NEQ "----------" (
if defined fileName (
echo !fileName!
set fileName=
)
echo %%i
) else (
set fileName=%%j
)
)
if exist %temp% (
del %temp% /q
)
:popvar
set string=!%0~string!
set fileName=!%0~fileName!
set temp=!%0~temp!
:end
- FindFile
- findfile
- findfile
- findFile
- FindFile
- findfile
- findfile.java
- findfile用法
- CFileFind::FindFile
- CFtpFileFind FindFile卡住的问题
- CFtpFileFind FindFile卡住的问题
- GetFileAttributes失败时可以尝试用FindFile代替
- CFileFind中FindFile与API中FindFirstFile的区别
- CFileFind中FindFile与API的FindFirstFile区别(CSDN问题)
- FindFile FindNextFile 如何遍历一个文件夹并获取里面文件的信息
- MFC中利用FindFile函数在文件夹路径下连续读取多个文件
- shell必学命令
- 单片机设计师理论基础考试复习大纲
- RTMP协议详解(转)
- .net设计模式之工厂模式学习笔记
- 【备忘】Java的Applet调用第三方jar包,web调用问题解决方案
- findFile
- 怎样使用 RSYNC?
- 黑马程序员_手机号码归属地查询
- tomcat启动时候,有事会因为某些问题(基本都是配置问题),导致tomcat启动一闪而过,错误看不到.
- 字符谜题之3:畜牧场,即“+”和“==”的优先级问题
- 简单的验证码实现
- Android2.2 API 中文文档系列(2) —— EditText
- Selenium-Webdriver系列教程(一)————快速开始
- 数据类型转换