Skip to content

Instantly share code, notes, and snippets.

@panayiotis
Created November 19, 2016 20:09
Show Gist options
  • Save panayiotis/ae99cda403324080070b58d92380b47a to your computer and use it in GitHub Desktop.
Save panayiotis/ae99cda403324080070b58d92380b47a to your computer and use it in GitHub Desktop.
# usefull bash commands for moss
# print submission dates
reset; ls -l */*.{tar,gz,rar} | awk '{for(i=6;i<=9;i++)printf "%s ",$i;printf "\n"}' | sort
# unzip archives
find . -type f -name *.tar -print0 | xargs -0 -I file sh -c 'tar -xf file -C `dirname file`'
find . -type f -name *.tar.gz -print0 | xargs -0 -I file sh -c 'tar -xzf file -C `dirname file`'
find . -type f -name *.rar -print0 | xargs -0 -I file sh -c 'unrar -y e file "`dirname file`"'
# delete archives
find . -type f -regex ".*\(tar\|gz\|rar\)" -delete
# move files in nested directories into base directory
find . -maxdepth 1 -type d -regex "\./\(sdi\|std\|grad\).*" | xargs -I dir sh -c 'find dir -mindepth 2 -type f | xargs -I file mv -f file dir'
# delete empty directories
find . -type d -empty -delete
# delete binaries
find . -type f -exec sh -c "file -i {} | grep binary >/dev/null" \; -print -delete
# print files in base directory in one line with -b prepended,
# this helps if you want to use moss -b option
find base -type f -print0 | xargs -I f -r0 echo -n -b "f "
# submit results
../moss.pl -x -l c -m 2 -d */*.h */*.c */*.cc
../moss.pl -x -l c -m 1000 -d */*.h */*.c */*.cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment