如何使用grep来查找'../images/“ [英] How to Use grep to find '../images/'

查看:222
本文介绍了如何使用grep来查找'../images/“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你怎么用grep来查找字符串出现在目录中,当搜索字符串为../images/?这是命令我通常使用它

How do you use grep to find occurrences of strings in a directory, when the string to search for is '../images/'? This is the command as I normally use it

grep -H -r 'string to find' /path/to/dir

某些搜索字符会导致问题,显然'../'是其中之一。

Some search characters cause problems, and evidently '../' is among those.

我试过\\各种combinatrions在某些字符前这是我需要经常做的,找到的CSS文件都指向图像隔壁的文件夹中引用的搜索。

I tried various combinatrions of \ in front of some characters This is a search I need to do frequently, to find references in css files that are pointing to images in the folder next door.

推荐答案

的点匹配使用grep任何字符。你需要用一个反斜杠,例如 preFIX它'\\。\\ ./图片/

The dot matches any character with grep. You need to prefix it with a backslash, e.g '\.\./images/'

这篇关于如何使用grep来查找'../images/“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆