last test-user | count_time.sh > test.txt
그러면 결과가
total login time = 01:24
이렇게 나오네요.
count_time.sh
#!/bin/sh
total_login_hour=0
total_login_minute=0
while read user tty ip weekday month date start_time dash end_time login_time; do
login_hour=${login_time:1:2}
login_minute=${login_time:4:2}
let total_login_hour+=login_hour
let total_login_minute+=login_minute
done
let total_login_hour+=total_login_minute/60
let total_login_minute%=60
printf "total login time = %02d:%02d\n" $total_login_hour $total_login_minute
'갈무리' 카테고리의 다른 글
[펌] .... (0) | 2008.09.18 |
---|---|
cakePHP 프레임워크 도움말 주소 (0) | 2008.03.19 |
htaccess 파일예제 (0) | 2008.02.05 |
리눅스 배포판 족보 (0) | 2008.01.23 |
[펌] 불편한 진실과 노무현.. (0) | 2008.01.02 |