#!/bin/sh # make fwendplanet curd="$PWD" cd "$1" || return 1 if [ -n "$2" ]; then page="$2" else page=1 fi if [ -n "$3" ]; then groupn="$(($3 * 24 * 3600))" else groupn=1 fi # echo "$@" "$page" "$groupn" >&2 awk -v page="$page" -v groupn="$groupn" -v now="$(date +%s)" \ 'BEGIN { FS = "\t"; OFS = "\t"; } { oldest = groupn*page if (oldest) oldest=now-oldest; else oldest=0 newest = groupn*(page-1) if (newest) newest=now-newest; else newest=now d=int($1) if (d>oldest && d<=newest) { # printf "%s\t%s\t%s\n", d, oldest, newest > "/dev/stderr" $2 = "[" FILENAME "] " $2 print } } ' * | sort -k1,1rn | "$curd/fwendplanet_html.awk"