How to convert date format using bash and printf?
问题 I want to convert 2019-02-16 to Feb 16 15:29 in bash using awk and printf . For example: [root@localhost ~]# who | awk '{print $1, $3, $4}' root 2019-02-16 15:29 root 2019-02-16 15:30 john 2019-02-01 10:34 emmett 2019-01-12 09:45 Desired output: root Feb 16 15:29 root Feb 16 15:30 john Feb 1 10:34 emmett Jan 12 09:45 Please help and provide an explanation with your solution. 回答1: With any awk in any shell on any UNIX box: $ who | awk '{split($3,d,/-/); print $1, substr(