English 中文(简体)
从一堆文件中获得没有单词的文件名
原标题:From a bunch of files, get filenames which don t have a given word

我有一堆文件 我想拿到那些文件的文件文件名 这些文件的内容里没有一个词

我想用一个单行语句在 shell 中做到这一点。 我知道要找到文件文件文件名并不难, 这些文件文件名中包含一个给定的单词 。

下面将给我所有包含一个单词的文件 。

find . | xargs grep -l "someword" | uniq

Update:
I thought that grep only works on a per line basis, but that s not true. So the above command can be changed to:

find . | xargs grep -l "someword"

因此,这个问题的答案显而易见:

find . | xargs grep -L "someword"
最佳回答

为此,应:

find . | xargs grep -L "someword" | uniq
问题回答

暂无回答




相关问题
KornShell- Creating a fixed width text file

I need to create a simple fixed width text file in KornShell (ksh). My current attempt using printf to pad the string isn t working out very well. What s the shortest, cleanest way to create a fixed ...

unix find command

how to use the find command to find files/directories which are not matching the pattern. for eg: find <some options > -name "dontfile.txt" should give me output of all the find whose file ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Case insensitive comparison of strings in shell script

The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?

1. 露台式照像

在Windows XP中,没有一时出现指挥时,是否有办法操作一种灰色文字? 我常常需要把“善待”(工作)与“灰色”同起来,即使我的文字没有产出,......

热门标签