[英]Grep a word in files with specific file extension in windows
我將使用以下命令來grep具有許多文件的目錄中的文本。
grep -irl "SampleText" *.txt
我的情況是只在.txt
文件中grep。 在Windows的命令提示符中執行上述命令時,會拋出一個錯誤
grep: *.txt: Invalid argument
我錯過了什么?
采用:
grep --include=*.txt -irl . -e "SampleText"
刪除l
參數以打印文本,它也是周圍的文本
並添加n
參數以查看找到的文本的行號
使用man grep
獲取更多信息
使用內置實用程序?
findstr /s /i /m "SampleText" *.txt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.