Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Awk strftime on Mac OS X

Tags:

bash

macos

awk

The following command on my Mac (10.6) gives me an undefined function error:

$ awk 'BEGIN{now=strftime("%D", systime()); print now}'
awk: calling undefined function strftime
 source line number 1

On a Red Hat system, I get the expected result:

$ awk 'BEGIN{now=strftime("%D", systime()); print now}'
12/01/09

What's the deal here?

like image 683
Jeremy White Avatar asked Dec 02 '09 06:12

Jeremy White


1 Answers

Use Homebrew and then just run brew install gawk

like image 184
5argon Avatar answered Sep 17 '22 20:09

5argon