【问题标题】:List filename not contain some keywords in the dictory file列表文件名不包含字典文件中的某些关键字
【发布时间】:2014-02-18 17:00:31
【问题描述】:

文件夹中有很多文件,文件名中包含时间戳信息,例如,

callMic-13501358220-414404433.caf   (414404433 is the timestamp)
callMic-18901111584-414235643.caf
....

我还有一个文本文件 (timestamp.txt),可以用作字典。文本文件每行包含很多时间戳,如下所示。

414247851
414235643
414226229
....
..

我想列出所有不包含 timestamp.txt 中列出的时间戳的文件名。

【问题讨论】:

  • Dictory 不是英文单词 - 你的意思是 directory (如磁盘上的“文件夹”),还是你的意思是 字典(作为内存中的数据结构)??

标签: grep ls


【解决方案1】:
grep -vFwf timstamp.txt filename.txt

如果您的文件名不在文件中,您可以

ls -1 or find magic..|grep -vFwf timestamp.txt

【讨论】:

  • 我认为是这样,尽管filename.txt 应该填充文件列表。
  • 谢谢,我想列出的文件名不包含 timestamp.txt 中列出的关键字。
  • @seanlv 你试过我的回答了吗?
  • 是的,我做到了。 :) 但它没有用。我用 ls -1 |grep -vFwf timestamp.txt
猜你喜欢
  • 2022-01-08
  • 1970-01-01
  • 1970-01-01
  • 2021-01-21
  • 1970-01-01
  • 2011-03-26
  • 2016-11-01
  • 1970-01-01
相关资源
最近更新 更多