반응형
http://blog.nominet.org.uk/tech/2005/05/26/tail-f-with-highlighting/ If you want to highlight something when doing ‘tail -f’ you can use the following command: tail -f /var/log/logfile | perl -p -e 's/(something)/33[7;1m$133[0m/g;'or if your terminal supports colours, e.g. linux terminal, you can use this: tail -f /var/log/logfile | perl -p -e 's/(something)/33[46;1m$133[0m/g;' and if you want it to beep on a match use this: tail -f /var/log/logfile | perl -p -e 's/(something)/33[46;1m$133[0m07/g;'If you find that perl is too heavy for this you can use sed: tail -f /var/log/logfile | sed "s/(something)/^[[46;1m1^[[0m/g" Note, that in the last example you have to actually type “cntl-v cntl-[” in place of “^[” For the full list of control characters on Linux you can look at ‘man console_codes’. |
반응형
'Tip & Tech > Linux | Unix' 카테고리의 다른 글
MySQL 리플리케이션 로그 핸들링 (0) | 2010.10.20 |
---|---|
php full compile options (0) | 2010.10.20 |
리눅스 타임존(time zone) 변경.. (0) | 2010.10.20 |
Bash 파일명 패턴으로 지우기 (0) | 2010.10.20 |
qmail control 파일들 (0) | 2010.10.20 |