diff options
Diffstat (limited to 'fwendplanet.sh')
-rwxr-xr-x | fwendplanet.sh | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/fwendplanet.sh b/fwendplanet.sh index 586f934..7ec7eb8 100755 --- a/fwendplanet.sh +++ b/fwendplanet.sh | |||
@@ -6,12 +6,31 @@ curd="$PWD" | |||
6 | cd "$1" || return 1 | 6 | cd "$1" || return 1 |
7 | 7 | ||
8 | if [ -n "$2" ]; then | 8 | if [ -n "$2" ]; then |
9 | old="$(($(date +%s) - ($2 * 24 * 3600)))" | 9 | page="$2" |
10 | else | 10 | else |
11 | old=0 | 11 | page=1 |
12 | fi | 12 | fi |
13 | 13 | ||
14 | awk -v old="$old" \ | 14 | if [ -n "$3" ]; then |
15 | 'BEGIN{FS="\t";OFS="\t";} int($1)>=old{$2="["FILENAME"] "$2;print}' * | | 15 | groupn="$(($3 * 24 * 3600))" |
16 | sort -k1,1rn | | 16 | else |
17 | "$curd/fwendplanet_html.awk" | 17 | groupn=1 |
18 | fi | ||
19 | |||
20 | # echo "$@" "$page" "$groupn" >&2 | ||
21 | |||
22 | awk -v page="$page" -v groupn="$groupn" -v now="$(date +%s)" \ | ||
23 | 'BEGIN { FS = "\t"; OFS = "\t"; } | ||
24 | { | ||
25 | oldest = groupn*page | ||
26 | if (oldest) oldest=now-oldest; else oldest=0 | ||
27 | newest = groupn*(page-1) | ||
28 | if (newest) newest=now-newest; else newest=now | ||
29 | d=int($1) | ||
30 | if (d>oldest && d<=newest) { | ||
31 | # printf "%s\t%s\t%s\n", d, oldest, newest > "/dev/stderr" | ||
32 | $2 = "[" FILENAME "] " $2 | ||
33 | |||
34 | } | ||
35 | } | ||
36 | ' * | sort -k1,1rn | "$curd/fwendplanet_html.awk" | ||