次のコマンドを実行するとします。
sudo ./list_members Physicians
次のように出力にプレフィックスを追加したいと思います。
Physicians [email protected]
Physicians [email protected]
Physicians [email protected]
Physicians [email protected]
StdOutputの前にこれらの接頭辞を付けることはできますか?
ベストアンサー1
ts
moreutilsパッケージのユーティリティを使用することをお勧めします。主な目的は、出力行の前にタイムスタンプを追加することですが、タイムスタンプの代わりに任意の文字列を使用することもできます。
for line in {01..05}; do echo $line; done | ts "A string in front "
A string in front 01
A string in front 02
A string in front 03
A string in front 04
A string in front 05