草庐IT

grepping

全部标签

grep 中的正则表达式用于包含 A、B、C...但不包含 Z 的文件

我花了几个小时试图用这个问题的部分答案自己回答这个问题;因此,如果这个问题已经得到解答,我深表歉意,但结合我能找到的部分解决方案来正确执行此搜索似乎超出了我的能力范围。我正在尝试做的事情:在一个目录中搜索以任何顺序在文件中的任何位置包含多个唯一字符串但不在文件中的任何位置包含另一个特定字符串的文件。p>这是我到目前为止的搜索:pcregrep-riM'^(?=.*uniquestringA)(?=.*uniquestringB)(?=.*uniquestringC)(?=.*uniquestringD)(?=.*uniquestringE).*$'.|xargsgrep-Li'uniq

regex - Grep for word and line before match

我有一个文本日志文件,其中包含多个条目,如下所示:Processinginput.jpg(323of500)...Detectingmatchesinregion1...Detectingmatchesinregion2...Detectingmatchesinregion3...Detectingmatchesinregion4...Detectingmatchesinregion(n)......NOTENOUGHMATCHES-FULLFILEOUTPUTProcessinginput1.jpg(324of500)...我想对文件进行grep以匹配出现FULLFILE序列的每个实

regex - Grep for word and line before match

我有一个文本日志文件,其中包含多个条目,如下所示:Processinginput.jpg(323of500)...Detectingmatchesinregion1...Detectingmatchesinregion2...Detectingmatchesinregion3...Detectingmatchesinregion4...Detectingmatchesinregion(n)......NOTENOUGHMATCHES-FULLFILEOUTPUTProcessinginput1.jpg(324of500)...我想对文件进行grep以匹配出现FULLFILE序列的每个实

linux - 如何grep两个时间范围之间的日志

我有一个日志文件abc.log,当我对它执行vi时,它的内容是这样的。2015-05-2818:12:00,815INFO0x7f6ed23e3700send_to-recent:1432861920fromdc:2client_id:1022015-05-2818:13:01,024INFO0x7f6ed23e3700send_to-recent:1432861980fromdc:2client_id:1012015-05-2818:13:42,244WARN0x7f6ed26e6700mgr-Failedtoupsertdataforuserid3589109212161withv

linux - 如何grep两个时间范围之间的日志

我有一个日志文件abc.log,当我对它执行vi时,它的内容是这样的。2015-05-2818:12:00,815INFO0x7f6ed23e3700send_to-recent:1432861920fromdc:2client_id:1022015-05-2818:13:01,024INFO0x7f6ed23e3700send_to-recent:1432861980fromdc:2client_id:1012015-05-2818:13:42,244WARN0x7f6ed26e6700mgr-Failedtoupsertdataforuserid3589109212161withv

linux - grep命令从json中查找key的值

请解释如何使用grep命令从以下json中提取一些指定的文本-{"result":"CustomerinformationsavedsuccessfullywithCustomerid:59andversion:1","status":{"responseCode":200,"result":null,"responseMessage":"Success","responseType":"info"}}经过一些谷歌搜索,看起来可以通过使用带有正则表达式的grep来实现。但它不起作用。能否请您指出错误catresponse.txt|grep-Po'(?假设:response.txt包含上

linux - grep命令从json中查找key的值

请解释如何使用grep命令从以下json中提取一些指定的文本-{"result":"CustomerinformationsavedsuccessfullywithCustomerid:59andversion:1","status":{"responseCode":200,"result":null,"responseMessage":"Success","responseType":"info"}}经过一些谷歌搜索,看起来可以通过使用带有正则表达式的grep来实现。但它不起作用。能否请您指出错误catresponse.txt|grep-Po'(?假设:response.txt包含上

linux - 如何在 grep 中指定忽略模式?

如何让grep在递归grep时忽略某些文件(例如.svn目录、二进制文件等)? 最佳答案 使用已回答的--exclude模式here 关于linux-如何在grep中指定忽略模式?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4068983/

linux - 如何在 grep 中指定忽略模式?

如何让grep在递归grep时忽略某些文件(例如.svn目录、二进制文件等)? 最佳答案 使用已回答的--exclude模式here 关于linux-如何在grep中指定忽略模式?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4068983/

linux - 如何更改 grep 查看文件/打印结果的顺序?

我有一个目录,里面有一堆文件名是数字的。它们没有前导零,所以如果我在该目录中执行类似grephello*的操作,我可能会得到如下内容:22:hello,world!6:hello62:"Sayhellotothemforme."我希望结果是这样的:6:hello22:hello,world!62:"Sayhellotothemforme."我想到的第一个想法是用grephello*|对结果进行数字排序sort-n但是我失去了grep的颜色,我想保留它。最好的方法是什么? 最佳答案 ls*|sort-n|xargs-d'\n'grep