find

简介: find

功能

在文件中搜索字符串。


用法

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[...]]点击复制复制失败已复制


参数说明:

  • /V: 显⽰所有未包含指定字符串的⾏。
  • /C: 仅显⽰包含字符串的⾏数。
  • /N: 显⽰⾏号。
  • /I: 搜索字符串时忽略⼤⼩写。
  • /OFF[LINE]: 不要跳过具有脱机属性集的⽂件。
  • "string": 指定要搜索的⽂字串,
  • [drive:][path]filename: 指定要搜索的⽂件。


提示

如果没有指定路径, FIND 将搜索键⼊的或者由另⼀命令产⽣的⽂字。


与type命令结合

Find 常和 type 命令结合使⽤,常用用法如下:

:: 挑选包含string的⾏
Type [drive:][path]filename | find "string" [>tmpfile]
:: 剔除⽂件中包含string的⾏
Type [drive:][path]filename | find /v "string"
:: 显⽰⽂件⾏数
Type [drive:][path]filename | find /c点击复制复制失败已复制


提示

以上⽤法将去除 find 命令⾃带的提⽰语(⽂件名提⽰)


示例

@echo off 
echo 111 >test.txt 
echo 222 >>test.txt 
find "111" test.txt 
del test.txt
pause点击复制复制失败已复制


运行输出:

---------- TEST.TXT
111点击复制复制失败已复制


@echo off 
echo 111 >test.txt 
echo 222 >>test.txt 
type test.txt|find "111" 
del test.txt 
pause点击复制复制失败已复制


运行输出:

111
目录
相关文章
|
算法 容器
常用查找算法 find() find_if() adjacent_find() binary_search() count() count_if()
常用查找算法 find() find_if() adjacent_find() binary_search() count() count_if()
|
Web App开发 JavaScript
$(...).find is not a function
$(...).find is not a function
183 0
Find a way
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.
130 0
|
安全 Shell
|
分布式计算 Hadoop 数据库