
Output: /dev/mapper/vg_saswork-prd-lv_sas-saswork 3.1T 2.2T 861G 73% I want to run this for each foldername that is produced from the output of the second command that is run.Īdding for more exact example Input: df -h| grep saswork This commands output will give me the userID. The piece I want to use as input in the 3rd command would be the folder name in bold above is what I would need to go into the third command, so the third command would look like this: ls -la| grep SAS_work438800007078_prdsasgridn03 There would be the top 20 results though. Whats the proper/easiest way to do this so I can do this repeatedly for say the top 5 folders and get the userIDs of those folders?
#UNIX GREP USAGE CODE#
To make code readable here it is broke into steps df -h| grep saswork I am using the following commandd to get the % of disk used df -h| grep workfld, than getting the top folders that are using the most disk space in %, the last piece would be to use the output/result from du -h /saswork | sort -rh | head -20 in the final grep command to get the USERID of the user who's folder this is.
