[COLUG] gawk question

Steven Huwig shuwig at columbus.rr.com
Sat Aug 19 00:14:03 EDT 2006


On Aug 18, 2006, at 9:54 PM, Nathan Overley wrote:

>
> I would like to be able to cd into this directory and run the  
> following
> command:
> ls -l |gawk '{print $9}' |grep -iv career
>
> Then would it be possible to take those results and remove the  
> directories?
>

That approach can work but you should probably use find instead. E.g.  
run this in the directory containing User1 and User2.

   $ find -d . -mindepth 2 \! -name career -exec rm -d -i {} \;

The -i flag at the end will prompt you for every file deletion, since  
I didn't test that command line thoroughly. You can remove it if you  
like.

   $ man find

will tell you more than you want to know.

-- Steve Huwig


More information about the colug432 mailing list