Search code examples
linuxbashsedngrep

piped sed does not output to file using ngrep


I am using ngrep to filter some tcp packetes into STDOUT Since it now become more important to log the output (after changing the result a bit usingsed) into a file.

piping it with sed looks OK in stdout - But no content is written when writing to dump.log

Below is the command:

grep -l -q -W none -i "^POST /somefile.php" tcp and port 80 | sed -e 's/^T/IP/g' >> dump.log

Having the impression that either sed or ngrep blocks the process of pushing the content.


Solution

  • Add -U to GNU sed to load minimal amounts of data from the input and flush the output buffers more often.