BASH redirect & grep -v help needed
Smoot Carl-Mitchell
smoot at tic.com
Wed Feb 18 22:55:49 UTC 2009
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? 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.
--
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005
More information about the ubuntu-users
mailing list