mdate.sh revision 18100
167760Smsmith#! /bin/sh 267760Smsmith 367760Smsmith# Print the modification date of $1 `nicely'. 467760Smsmith 567760Smsmith# Don't want foreign dates. 667760Smsmith 767760SmsmithLANGUAGE= 867760Smsmith 967760Smsmith 1067760Smsmith(date; 1167760Smsmithif ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi 1267760Smsmith) | awk ' 1367760SmsmithBEGIN { 1467760Smsmith full["Jan"] = "January"; number["Jan"] = 1; 1567760Smsmith full["Feb"] = "February"; number["Feb"] = 2; 1667760Smsmith full["Mar"] = "March"; number["Mar"] = 3; 1767760Smsmith full["Apr"] = "April"; number["Apr"] = 4; 1867760Smsmith full["May"] = "May"; number["May"] = 5; 1967760Smsmith full["Jun"] = "June"; number["Jun"] = 6; 2067760Smsmith full["Jul"] = "July"; number["Jul"] = 7; 2167760Smsmith full["Aug"] = "August"; number["Aug"] = 8; 2267760Smsmith full["Sep"] = "September"; number["Sep"] = 9; 2367760Smsmith full["Oct"] = "October"; number["Oct"] = 10; 2467760Smsmith full["Nov"] = "November"; number["Nov"] = 11; 2567760Smsmith full["Dec"] = "December"; number["Dec"] = 12; 2667760Smsmith} 2767760Smsmith 2867760SmsmithNR == 1 { 2967760Smsmith month = $2; 3067760Smsmith year = $NF; 3167760Smsmith} 32148318Snjl 33148318SnjlNR == 2 { 34148318Snjl if ($(NF-1) ~ /:/) { 3567760Smsmith if (number[$(NF-3)] > number[month]) 3667760Smsmith year--; 3791130Smsmith } 38128225Snjl else 3967760Smsmith year = $(NF-1); 4067760Smsmith print $(NF-2), full[$(NF-3)], year 4167760Smsmith}' 4267760Smsmith