Software >> OS >> Unix >> Solaris >> awk >>  How to do formatted print with awk

Example 1 - obtain the date stamp in yyyy-Mmm-dd format from ls output # ls -lahe | awk '{printf "%s-%s-%s\n",,,}' Example 2 - obtain the date and timestamp and file name from ls output # ls -lahe | awk '{printf "%4s-%3s-%s:%2s:%2s:%2s %s\n",,,,substr(,1,2),substr(,4,2),substr(,7,2),}'