Skip to main content
edited tags
Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Source Link
Guif If
  • 103
  • 2

Format date output with spaces into awk

I want to make the date command with nice formatting like this:

awk -F, '{system("date -d " $1 " +%d/%m/%Y %H:%M")}' file.log

However it does not work

Try 'date --help' for more information.
date: extra operand ‘%H:%M’

What is correct way to do this, so that date command to get one correct argument? Why it fails when I put an space between "year" and "hour"?

Thanks in advance