如何查找缺少必需字符串的文件? [英] How to find file that is missing a required string?

查看:165
本文介绍了如何查找缺少必需字符串的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的OS X命令行,我想找到所有以.per结尾的文件,它们缺少字符串'connection_id'。

On my OS X command line, I would like to find all files ending in .per that are missing the string 'connection_id'.

这样做。找到具有给定字符串的文件很容易,但是如果字符串丢失,我不知道如何做。

How do I go about doing this. Finding the files that have a given string is easy but am not sure how to do this if the string is missing.

谢谢!

推荐答案

find . -name '*.per' \! -exec grep -q 'connection_id' {} \; -print

这篇关于如何查找缺少必需字符串的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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