coreboot-kgpe-d16/util/board_status/to-wiki/bucketize.sh
Elyes HAOUAS 52648623e0 Remove empty lines at end of file
Used command line to remove empty lines at end of file:
find . -type f -exec sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' {} \;

Change-Id: I816ac9666b6dbb7c7e47843672f0d5cc499766a3
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: http://review.coreboot.org/10446
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2015-06-08 00:55:07 +02:00

33 lines
633 B
Bash
Executable file

#!/bin/sh
# usage: $0 [weekly|monthly|quarterly] < filenames
# sorts files of the form VENDOR/BOARD/COMMIT/DATE/revision.txt
# into buckets of the given granularity
weekly() {
date --date="$1" +%GW%V
}
monthly() {
date --date="$1" +%Y-%m
}
quarterly() {
date --date="$1" "+%Y %m" | awk '{ q=int(($2-1)/3+1); print $1 "Q" q}'
}
# TODO: restrict $1 to allowed values
curr=""
sort -r -k4 -t/ | while read file; do
timestamp=`printf $file | cut -d/ -f4`
new=`$1 $timestamp`
if [ "$new" != "$curr" ]; then
if [ "$curr" != "" ]; then
printf "\n"
fi
printf "$new:"
curr=$new
fi
printf "$file "
done
printf "\n"