Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!rochester!kodak!ispd-newsserver!weimer From: weimer@ssd.kodak.com (Gary Weimer) Newsgroups: comp.unix.questions Subject: Re: root owned files/world writable Message-ID: <1990Nov15.162559.4098@ssd.kodak.com> Date: 15 Nov 90 16:25:59 GMT References: <1990Nov14.224701.15657@cs.odu.edu> Sender: news@ssd.kodak.com Distribution: na Organization: Eastman Kodak Lines: 34 In article <1990Nov14.224701.15657@cs.odu.edu> epperly@cs.odu.edu (William "Badger" Epperly) writes: > [trying to find world-writeable files owned by root. following doesn't work] > >find / -user root -ls | awk {'if substr($1,9,1)=w print>test.out first, syntax for awk is wrong, you want something like: awk ' {if (substr($1,9,1) == "w" ) print $8 > "test.out" } ' ^ ^ ^ ^^ ^ ^ ^ ^^ ^ ^ ^ ^ 1 2 3 4 5 5 3 6 5 5 2 1 1) a single quote needs to surround the of awk 2) currly brackets are also needed for 3) if stmt's condition needs to be surrounded by parens (sp?) 4) equallity is tested using double = 5) all text must be enclosed in quotes, or it is assumed to be a variable 6) you may or may not want to add this to get only the file name second, find's -ls does not produce the same output as 'ls -al'. It produces something like: 9601 1 drwxr-xr-x 3 weimer staff 512 Nov 13 11:42 file_name so the command you want to use would be: find / -user root -ls | awk '{if (substr($3,9,1)=="w") print $11 > "test.out"}' Hope this helps. P.S. you might also want to find file owned by root that are group writeable and are part of some universal group (like 'user'). Gary Weimer