home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / cmplngmg / cl_jun89.arc / AWK210.ARC / DIR.AWK < prev    next >
Text File  |  1988-03-06  |  683b  |  29 lines

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