[COLUG] gawk question

Josh Glover jmglov at gmail.com
Sat Aug 19 00:54:29 EDT 2006


On 19/08/06, Nathan Overley <noverley at sm.k12.oh.us> wrote:

> Say the directory structure looks like so:
> User1-|
>       |-career
>       |-dir1
>       |-dir2
>       |-file1
>       |-file2
> User2-|
>       |-career
>       |-dir1
>       |-dir2
>       |-file1
>       |-file2
>
> I would like to be able to cd into this directory and run the following
> command:
> ls -l |gawk '{print $9}' |grep -iv career

How about:

STUDENTS="User1 User2 ... UserN"
cd /home
for i in ${STUDENTS}; do
  find $i/ -maxdepth 1 -type -d | grep -iv career | xargs rm -rf
done

Wouldn't that "git 'er done"?

-Josh


More information about the colug432 mailing list