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