Deleting old SGE output and error files

I use SGE– Son of Grid Engine, to run many batch jobs needed for my research.  It’s possible to send all of your log files directly to the garbage ( i.e. redirect it to /dev/null ) but I generally like to inspect them in case anything goofed up.

Cleaning up the files after a successful run can be done by the following

find . -regex '.*\.e[0-9]+.*' -ls -delete

What this command does is it uses the linux find command… and starting from the “.” directory.. which is my current working directory.. or I could specify something like

find /home/dgutman/SGE_OUTPUT If all of my error logs were winding up in that directory… It then will do a regular expression match for all files that look have a “.e####” after it.. basically something like job1.e2343 ; when SGE runs it will output all error and output data to a .e and .o file…. so this will find all the .e files… list them… and then also delete them….. If you omit the -delete it will simply list them.. which can be convenient in case you have other files you don’t want to delete that for whatever odd reason have an extension that starts with the letter ‘e’ following by digits… The same thing can be done for the *.o### files…