From 8ba0a8a99517c0ab76a2d672b3c2dba5241bb3a3 Mon Sep 17 00:00:00 2001
From: Andrew Yates <ayates@ebi.ac.uk>
Date: Tue, 10 Jan 2012 16:53:23 +0000
Subject: [PATCH] Adding in a script to make the yearly copyright notification
 update a bit easier

---
 misc-scripts/annual_copyright_updater.sh | 30 ++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100755 misc-scripts/annual_copyright_updater.sh

diff --git a/misc-scripts/annual_copyright_updater.sh b/misc-scripts/annual_copyright_updater.sh
new file mode 100755
index 0000000000..21b8ddd7a7
--- /dev/null
+++ b/misc-scripts/annual_copyright_updater.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+function confirm()
+{
+    echo -n "$@ "
+    read -e answer
+    for response in y Y yes YES Yes Sure sure SURE OK ok Ok
+    do
+        if [ "_$answer" == "_$response" ]
+        then
+            return 0
+        fi
+    done
+	
+    return 1
+}
+
+year=$(date "+%Y")
+last_year=$(($year - 1))
+
+search="Copyright (c) 1999-${last_year}"
+replacement="Copyright (c) 1999-${year}"
+
+confirm "About to scan $(pwd) for files to replace '$search' with '$replacement'. Ok?"
+
+for file in $(grep -R --files-with-matches "$search" .); do
+	echo "Replacing date in $file"
+	sed -i "s/$search/$replacement/g" $file
+done
+
-- 
GitLab