ナビゲーションモード[オフ]

ナビゲーションモード[オフ]

ファイルセットに異なる文字列* .dbmが何回存在するかを調べる必要があります。つまり。同じファイル名test1.dbm test2.dbmには2つの異なる文字列があるため、test1.dbmはfile1_10172017.txtにあり、文字列test2.dbmは別のfile1_10162017.txtにあります。

同じ名前のファイルセットに(* .dbm)がどれだけ存在するかを調べる必要があります(タイムスタンプが異なります)。

ベストアンサー1

fx273014_w_new_qul_[timestamp].txtすべてのディレクトリを含むディレクトリ全体でこれを繰り返し実行できます。

grep -ohr "\w*\.dbm" /path/to/dir | sort -u

~からman grep

-h, --no-filename
    Suppress the prefixing of file names on output. This is the default
    when there is only  one  file  (or only standard input) to search.
-o, --only-matching
    Print  only  the matched (non-empty) parts of a matching line,
    with each such part on a separate output line.
-R, -r, --recursive
         Recursively search subdirectories listed.

それぞれの固有の発生回数を計算するには、以下wc -lを追加します。

grep -ohr "\w*\.dbm" /path/to/dir | sort -u | wc -l

または、再帰的に実行せずに目的のファイルに対してこれを実行します。

grep -oh "\w*\.dbm" /path/to/fx273014_w_new_qul_* | sort -u | wc -l

おすすめ記事