Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
出力がカンマで区切られるように、awkからの出力をフォーマットして使用しようとしています。今私はこれを持っています:
ids ="`smartctl -A /dev/ssd |awk '/^[0-9]/ {if ($4 < $6) {print $1}}'`"
私の出力は次のようになります。
111 222 333
しかし、私はこのようなものが欲しい:
111,222,333
また、私の正規表現は 1 から 99 までの数字と一致しません。なぜですか?
迅速かつ汚い:
your command|awk...|paste -s -d','
例えば:
kent$ paste -s -d',' <<< "a b c d" a,b,c,d