1#! /bin/sh
2
3# Print the modification date of $1 `nicely'.
4
5# Don't want foreign dates.
6
7LANGUAGE=
8LC_ALL=C; export LC_ALL
9
10
11(date;
12if ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi
13) | awk '
14BEGIN {
15	full["Jan"] = "January"; number["Jan"] = 1;
16	full["Feb"] = "February"; number["Feb"] = 2;
17	full["Mar"] = "March"; number["Mar"] = 3;
18	full["Apr"] = "April"; number["Apr"] = 4;
19	full["May"] = "May"; number["May"] = 5;
20	full["Jun"] = "June"; number["Jun"] = 6;
21	full["Jul"] = "July"; number["Jul"] = 7;
22	full["Aug"] = "August"; number["Aug"] = 8;
23	full["Sep"] = "September"; number["Sep"] = 9;
24	full["Oct"] = "October"; number["Oct"] = 10;
25	full["Nov"] = "November"; number["Nov"] = 11;
26	full["Dec"] = "December"; number["Dec"] = 12;
27}
28
29NR == 1 {
30	month = $2;
31	year = $NF;
32}
33
34NR == 2 {
35	if ($(NF-1) ~ /:/) {
36		if (number[$(NF-3)] > number[month])
37			year--;
38	}
39	else
40		year = $(NF-1);
41	print $(NF-2), full[$(NF-3)], year
42}'
43