[COLUG] gawk question
Nathan Overley
noverley at sm.k12.oh.us
Fri Aug 18 21:54:20 EDT 2006
I am the Network Administrator for a school system and I am in the process of
cleaning up my students home directories. I would like to be able to delete
all files and folders from their directories except for a folder called
"career". Each student has this folder. Is there a way by using gawk, grep,
etc. to do this?
Say the directory structure looks like so:
User1-|
|-career
|-dir1
|-dir2
|-file1
|-file2
User2-|
|-career
|-dir1
|-dir2
|-file1
|-file2
So far I have a script that looks like this.
ls -l |gawk '{print $9}'
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?
I hope this makes sense.
Thanks,
Nathan
More information about the colug432
mailing list