Last active
August 29, 2015 14:02
-
-
Save rhopp/71bb22321a40626a5b95 to your computer and use it in GitHub Desktop.
This script decreases time by one day for usage events in given workspace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
if [[ -z "$1" ]] ; then | |
echo "This script needs parameter pointing to eclipse workspace" | |
elif ! [[ -d $1 ]] ; then | |
echo "$1 is not a directoryr" | |
elif ! [[ -d "$1/.metadata/.plugins/org.jboss.tools.usage/events" ]] ; then | |
echo "$1 does not contain .metadata/.plugins/org.jboss.tools.usage/events subdirectory (perhaps JBoss Tools Usage was not allowed?)" | |
else | |
FILES="$1/.metadata/.plugins/org.jboss.tools.usage/events/*" | |
for f in $FILES | |
do | |
echo "Processing file $f" | |
ROW=`sed -n '/d=/p' $f` # extract row containing "d=<number>" | |
DATE=`echo $ROW | cut -d'=' -f 2` # extract number from this row (represents java date in miliseconds) | |
NEW_DATE=$(( $DATE - 86400000 )) # decrease the number by one day (in miliseconds) | |
sed -i '/d=/s/^.*$/d='$NEW_DATE'/' $f # write this new number to the same file | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment