[英]Sorting files based on content using command line
我在一個文件夾中有一個文件數據庫。 我希望將包含*C:
的文件排序到一個文件夾中,並將包含*c:
的文件排序到另一個文件夾中。 如何做到這一點?**
我可以使用*.krn
訪問每個文件。
$ grep --help | grep with-matches
-l, --files-with-matches print only names of FILEs containing matches
現在的情況取決於有多少個文件,以及您對它們的名稱有多偏執。 從最簡單的
mv $(grep -l pattern files) target
到最堅固
grep -l -Z pattern files | xargs -0 mv -t target-directory --
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.