Paul on Thu, 10 Oct 2002 10:00:05 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] list by owner




How could I sort a list of files by owner? I have a bunch of session files in /tmp that I want to delete without affecting files that I don't own.



To list my files only,

   ls -l | awk '$3 == "jeff" {print;}'

To create a function, you'll have to fiddle with variable
interpolation to get it right.

If you want just file names, that becomes

   ls -l | awk '$3 == "jeff" {print $9;}'


Thanks! The second command worked for me. I added rm to it. rm ` ls -l | awk '$3 == "myname" {print $9;}'` And I actually understand it. awk reads the third column which is my username and it prints out the ninth column which is the filename owned by me. awk is a little bit scary, but it's cool.



_________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce General Discussion -- http://lists.netisland.net/mailman/listinfo/plug