2

Normally in a Linux command you can specify another one to be run at the same time like this:

ls | grep "sys" 

for example. In my case I have this command:

urlsnarf -i wlan0

and I can edit it like this to show filtered output:

urlsnarf -i wlan0 | cut -d\" -f4

but I also want to save the output to file and at the same time print text in the console so I edit it like this:

urlsnarf -i wlan0 | cut -d\" -f4 | tee output

but there is neither an output file nor printed output. Is there any way to fix this?

  • 2
    This question would fit better on other StackExchange sites, namely [SuperUser](http://superuser.com/?as=1) and/or [ServerFault](http://serverfault.com/?as=1) – SamGamgee Jul 05 '13 at 11:39

1 Answers1

0

I imagine what's happening here is the pipe is being buffered. I haven't seen urlsnarf before, but it looks like it's a continuous monitoring process. According to the following post, you can't easily stop the pipe from being fully buffered:

How to make output of any shell command unbuffered?

The article linked from an answer there is a good read: buffering in standard streams

Community
  • 1
  • 1
paddy
  • 60,864
  • 6
  • 61
  • 103