2013-11-15 07:57:31 -05:00
|
|
|
#!/usr/bin/awk -f
|
|
|
|
# A simple awk script to update copyright lines
|
|
|
|
# It can be used in a simple loop, e.g.:
|
|
|
|
#
|
|
|
|
# cd src
|
|
|
|
# for i in $a; do
|
|
|
|
# echo $i
|
|
|
|
# ../update_copyright.sh $i >xx
|
|
|
|
# rc=$?
|
|
|
|
# if [ $rc == "0" ]; then
|
|
|
|
# echo "$i contains no (c)."
|
|
|
|
# else
|
|
|
|
# mv xx $i
|
|
|
|
# fi
|
|
|
|
# done
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
found_something=0;
|
|
|
|
}
|
|
|
|
/\(C\)/ {
|
|
|
|
if(index($4,"-")>0)
|
2015-03-29 20:31:42 -04:00
|
|
|
new_years=gensub("-.*$","-2015",1,$4);
|
2013-11-15 07:57:31 -05:00
|
|
|
else
|
2015-03-29 20:31:42 -04:00
|
|
|
new_years=$4"-2015";
|
2013-11-15 07:57:31 -05:00
|
|
|
line = $0;
|
|
|
|
sub($4,new_years,line);
|
|
|
|
print line;
|
|
|
|
found_something=1;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
print $0;
|
|
|
|
}
|
|
|
|
END {
|
|
|
|
exit(found_something);
|
|
|
|
}
|
|
|
|
|