4,493,358 th visitor since 2017.2.1 ( Today : 2010 )
Computer ???
No. 436
Name. swindler
Subject. tali -f , grep, sed, awk 등을 연결해서 사용할때 제대로 안 나오는 경우
Main Cate. Linux
Sub Cate.
Date. 2013-10-02 11:41
Hit. 5694 (211.36.27.3)
File.
tail -f xxx.log | grep jsp 와 같은 형태는 많이 사용한다.

그런데
tail -f xxx.log | grep jsp | awk '{print $1}' 와 같은 형태로 사용하면
아무런 출력이 나오지 않는 경우가 있다.

혹자의 말에 따르면
C Standard IO 라이브러리가 buffering을 하기 때문이란다.

grep 에는 --line-buffered 라는 옵션이 있고,
sed 에는 -u (--unbuffered) 라는 옵션이 있다.

이 옵션을 주고 사용하면 된다.

[바로가기 링크] : http://coolx.net/cboard/computer/436



swindler grep에서 파일명이 안 나오는 경우에는 grep -H 를 사용하면 됨 2017-03-13
Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog