次の3行の例は、次のように抽出されました。
grep "Time to convert event = "[1-9] output.log
ただし、低い数字から高い数字にソートできる必要があります。Time to convert event = x.xxxxxx
これはどのように達成できますか?
2019-10-31 07:18:17.770 INFO [WORKER_Thread-4] [blahblah:212] [userID:] [eventID:] [objectID:] [] Time to convert event = 5.516262
2019-10-31 07:18:17.770 INFO [WORKER_Thread-4] [blahblah:212] [userID:] [eventID:] [objectID:] [] Time to convert event = 19.516262
2019-10-31 07:18:17.770 INFO [WORKER_Thread-4] [blahblah:212] [userID:] [eventID:] [objectID:] [] Time to convert event = 0.316262
ベストアンサー1
sort
a)フィールド区切り記号(-t
)の指定、b)フィールドによるソート-k
、c)-n
数値順のソートを許可します。
grep "Time to convert event = [1-9]" output.log | sort -n -t= -k2
=
数字の直前に1つだけを活用する必要があります。