BASH redirect & grep -v help needed
Smoot Carl-Mitchell
smoot at tic.com
Wed Feb 18 20:57:12 UTC 2009
On Wed, 2009-02-18 at 20:44 +0000, dave selby wrote:
> Hi All,
>
> I am trying to get the standard output and error streams to be
> filtered so that any output with the string 'saved as' is discarded
> and the rest is appended to /home/dave/kmotion2/www/motion_output
> Me and BASH just do not get on, I have tried
>
> motion -c /home/dave/kmotion2/core/motion_conf/motion.conf &> | grep
> -v 'saved as' >> /home/dave/kmotion2/www/motion_output
> bash: syntax error near unexpected token `|'
>
> Any idea how to make this work
motion -c /home/dave/kmotion2/core/motion_conf/motion.conf 2>&1 | grep
-v 'saved as' >> /home/dave/kmotion2/www/motion_output
This will pipe both the stdout and stderr through grep. e.g. redirect
stderr (file descriptor 2) to file descriptor 1 (stdout).
--
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