home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / awk / awk320.zip / DIR.AWK < prev    next >
Text File  |  1990-09-04  |  685b  |  30 lines

  1. # dir - list directory with date interpretation
  2. #
  3. # date interpretation  COUNTRY=44
  4.  
  5. BEGIN {
  6.     split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", month, " ");
  7. }
  8. NF == 5 {
  9.     if (date(4))
  10.         $0 = sprintf("%-9s%-3s%9s%11s%8s", $1,$2,$3,f4=$4,$5)
  11. }
  12. NF == 4 {
  13.     date(3)
  14.     if ($2 ~ /<DIR>/)
  15.         $0 = sprintf("%-9s%9s%14s%8s", $1,$2,$3,$4)
  16.     else
  17.         $0 = sprintf("%-9s%12s%11s%8s", $1,$2,$3,$4)
  18. }
  19. { print }
  20. function date(i) {
  21.     if ($i ~ /[0-9]+-[0-9]+-[0-9]+/) {
  22.         n = split($i, mdy, "-")
  23.         mdy[1] = month[int(mdy[1])]
  24.         $i = sprintf("%2d-%3s-%02d", mdy[2], mdy[1], mdy[3])
  25.         return 1
  26.     }
  27.     return 0
  28. }
  29.  
  30.