ファイルの各行を入力ファイルに変換

ファイルの各行を入力ファイルに変換

ファイルの各行を入力ファイルに変換/使用しようとしています。たとえば、file.txt次の行が含まれます。

cat
dog
lion
tiger
rabbit

次に、次のコマンドを使用します。

cat file.txt | parallel -j 3 "cat "/path/to/tool/toolname" --dir {}.txt --log "/path/to/output/output.txt""

そのうち、変換された5つのファイルにはそれぞれが{}.txtあり、別々のファイルを入力ファイルとして使用して上記のいくつかの操作を実行するとします。この目標をどのように達成できますか?それでは、まずファイルの各行を入力ファイルに変換するにはどうすればよいですか?cat dog lion tigerrabbit

@Ole Tangeについて考えていますか?他のすべての提案を歓迎します!

ベストアンサー1

cat file.txt |
  parallel --pipe -n1 --cat -j 3 "cat "/path/to/tool/toolname" --dir {} --log "/path/to/output/output.txt""

例:

cat file.txt |
  parallel --pipe -n1 --cat wc {}

cat file.txt |
  parallel --pipe -n1 --cat 'echo File number {#} contains;cat {}'

cat file.txt |
  parallel --pipe -n1 --cat clamscan --dir {} --log sig_scan.log

おすすめ記事