tcpdump | grep pattern > capture nothing got

Dimitry Andric dim at FreeBSD.org
Wed Nov 20 22:39:03 UTC 2013


On 20 Nov 2013, at 19:44, Florent Peterschmitt <florent at peterschmitt.fr> wrote:
> I use FreeBSD 10.0-BETA3 amd64, upgraded from 9.2-RELEASE with
> freebsd-update.
> 
> I was capturing with tcpdump and doing some grep on it:
> 
> # tcpdump -li nfe0 port 53 | grep Refused > capture.txt
> 
> I was surprised that capture.txt is totally empty. If I don't redirect
> the output, then it writes what I need on stdout.

Try grep --line-buffered instead (which incurs a performance penalty,
but you probably don't care in this case).

BSD grep also supports this option.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20131120/dd8fc0ea/attachment.sig>


More information about the freebsd-stable mailing list