Grep a file

Kirk Strauser kirk at strauser.com
Wed Jan 17 23:05:07 UTC 2007


On Wednesday 17 January 2007 14:52, Joshua Lewis wrote:
> When I run:
> sudo grep -v '^\;'extentions.conf > new_extentions.conf
>
> I get:
> -bash: new_extentions.conf: Permission denied

You're running grep via sudo, but the redirection is handled by the shell, 
wish is still running as you.

Either run "sudo -s" to get a root prompt, or:

   sudo sh -c "grep -v '^\;'extentions.conf > new_extentions.conf"

which runs your entire command line, redirection and all, as root.
-- 
Kirk Strauser
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070117/3a94cf78/attachment.pgp


More information about the freebsd-questions mailing list