BASH redirect & grep -v help needed
dave selby
dave6502 at googlemail.com
Fri Feb 20 21:29:41 UTC 2009
2009/2/18 Smoot Carl-Mitchell <smoot at tic.com>:
> On Wed, 2009-02-18 at 21:34 +0000, dave selby wrote:
>> >> So any idea why xxx.out contains zsip instead of the above ?
>> >
>> > No idea. What happens without the stderr redirection?
>>
>> motion -c /home/dave/kmotion2/core/motion_conf/motion.conf 2>&1 | grep
>> -v 'saved to'
>>
>> works a treat. 'motion' starts, outputs and keeps running and I have
>> to ctrl-c to stop it.
>>
>> motion -c /home/dave/kmotion2/core/motion_conf/motion.conf 2>&1 | grep
>> -v 'saved to' >> xxx.out
>>
>> outputs nothing, but zip in xxx.out
>>
>> I am wondering if the output to the BASH shell is 'instant' but the
>> output to >> is only processed on 'motion' ending
>> in some way ?
>
> Are you saying "motion -c" has continuous output?
It appears to have.
If that is the case
> then you are seeing I/O buffering side effects. Try adding
> --line-buffered to the grep command. That will flush the output buffer
> after each line.
OK I did not realize grep could do this. Many thanks, Sorry for the
delay, work related
Cheers
Dave
> Smoot Carl-Mitchell
> Computer Systems and
> Network Consultant
> smoot at tic.com
> +1 480 922 7313
> cell: +1 602 421 9005
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
More information about the ubuntu-users
mailing list