stdout 에 대한 timestamp 앞에 찍어주기

1. awk를 사용할 경우,

# echo "hello" |awk '{ print strftime("%Y-%m-%dT%H:%M:%S%z", systime()),$0 }'
2023-09-14T14:46:34+0900 hello

2. moreutils 의 ts 유틸 사용시

# apt-get install moreutils

# echo "hello" |ts -m "%Y-%m-%dT%H:%M:%S%z"
2023-09-14T14:44:19+0900 hello

stdout 에 대한 timestamp 앞에 찍어주기”의 1개의 생각

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다