findコマンドで代替拡張子を使用してファイル名を取得する方法

findコマンドで代替拡張子を使用してファイル名を取得する方法

デキストランファイルを変換するツールです。一般的な使用法はです。拡張子の代わりに拡張子を使用してコマンドからファイル名を取得するdextract -q test.h5 > test.fastq方法など、findコマンドとどのように結合しますか?find All_RawData/Each_Cell_Raw/ -name "*.bax.h5" | xargs -I {} dextract -q {} >>findfastqh5

ベストアンサー1

このように:

find All_RawData/Each_Cell_Raw -name '*.bax.h5' -exec sh -c 'for f do dextract -q "$f" > "${f%.h5}.fastq"; done' find-sh {} +

読みやすくするために、いくつかの改行があります。

find All_RawData/Each_Cell_Raw -name '*.bax.h5' -exec sh -c '
  for f
    do dextract -q "$f" > "${f%.h5}.fastq"
  done' find-sh {} +

説明と根拠については、以下を参照してください。https://unix.stackexchange.com/a/321753/135943

おすすめ記事