diff options
author | wlemb <wlemb> | 2000-02-06 09:34:01 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2000-02-06 09:34:01 +0000 |
commit | 653c6faab591f3c5f290a18a7f58c29cb1a3b0a7 (patch) | |
tree | 633fec7ba17c3da901e7725d1907a103a17e4532 /mdate.sh | |
download | groff-653c6faab591f3c5f290a18a7f58c29cb1a3b0a7.tar.gz |
Initial revision
Diffstat (limited to 'mdate.sh')
-rw-r--r-- | mdate.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mdate.sh b/mdate.sh new file mode 100644 index 00000000..6bdac9d4 --- /dev/null +++ b/mdate.sh @@ -0,0 +1,41 @@ +#! /bin/sh + +# Print the modification date of $1 `nicely'. + +# Don't want foreign dates. + +LANGUAGE= + + +(date; +if ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi +) | awk ' +BEGIN { + full["Jan"] = "January"; number["Jan"] = 1; + full["Feb"] = "February"; number["Feb"] = 2; + full["Mar"] = "March"; number["Mar"] = 3; + full["Apr"] = "April"; number["Apr"] = 4; + full["May"] = "May"; number["May"] = 5; + full["Jun"] = "June"; number["Jun"] = 6; + full["Jul"] = "July"; number["Jul"] = 7; + full["Aug"] = "August"; number["Aug"] = 8; + full["Sep"] = "September"; number["Sep"] = 9; + full["Oct"] = "October"; number["Oct"] = 10; + full["Nov"] = "November"; number["Nov"] = 11; + full["Dec"] = "December"; number["Dec"] = 12; +} + +NR == 1 { + month = $2; + year = $NF; +} + +NR == 2 { + if ($(NF-1) ~ /:/) { + if (number[$(NF-3)] > number[month]) + year--; + } + else + year = $(NF-1); + print $(NF-2), full[$(NF-3)], year +}' |