mdate.sh revision 18099
118099Spst#! /bin/sh 218099Spst 318099Spst# Print the modification date of $1 `nicely'. 418099Spst 518099Spst# Don't want foreign dates. 618099Spst 718099SpstLANGUAGE= 818099Spst 918099Spst 1018099Spst(date; 1118099Spstif ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi 1218099Spst) | awk ' 1318099SpstBEGIN { 1418099Spst full["Jan"] = "January"; number["Jan"] = 1; 1518099Spst full["Feb"] = "February"; number["Feb"] = 2; 1618099Spst full["Mar"] = "March"; number["Mar"] = 3; 1718099Spst full["Apr"] = "April"; number["Apr"] = 4; 1818099Spst full["May"] = "May"; number["May"] = 5; 1918099Spst full["Jun"] = "June"; number["Jun"] = 6; 2018099Spst full["Jul"] = "July"; number["Jul"] = 7; 2118099Spst full["Aug"] = "August"; number["Aug"] = 8; 2218099Spst full["Sep"] = "September"; number["Sep"] = 9; 2318099Spst full["Oct"] = "October"; number["Oct"] = 10; 2418099Spst full["Nov"] = "November"; number["Nov"] = 11; 2518099Spst full["Dec"] = "December"; number["Dec"] = 12; 2618099Spst} 2718099Spst 2818099SpstNR == 1 { 2918099Spst month = $2; 3018099Spst year = $NF; 3118099Spst} 3218099Spst 3318099SpstNR == 2 { 3418099Spst if ($(NF-1) ~ /:/) { 3518099Spst if (number[$(NF-3)] > number[month]) 3618099Spst year--; 3718099Spst } 3818099Spst else 3918099Spst year = $(NF-1); 4018099Spst print $(NF-2), full[$(NF-3)], year 4118099Spst}' 42