-1

Hi i want to convert UNIX date to normal date (YYYY-MM-DD)

22222,0,0,0,14387
33333,0,0,0,14170
44444,0,0,0,14244
55555,0,0,0,14190
66666,0,0,0,14528
77777,0,0,0,14200
88888,0,0,0,0
99999,0,0,0,0

here 5th column represents UNIX date

i want to convert into

22222,0,0,0,2009-05-23

and similarly remaining rows

can any body help me

Anders
  • 6,188
  • 4
  • 26
  • 31
user400480
  • 563
  • 2
  • 5
  • 5
  • 4
    Language? Context? You're going to have to give us something to go on. – Cfreak Jul 26 '10 at 14:25
  • possible duplicate of [Unix epoch time to Java Date Object](http://stackoverflow.com/questions/535004/unix-epoch-time-to-java-date-object) – Matt Ball Jul 26 '10 at 14:27

1 Answers1

5

A simple awk script ought to do it

awk -F, 'BEGIN{OFS=","} { print $1,$2,$3,$4,strftime("%Y-%m-%d",$5) }' myFile.txt

Cheers.

EDIT:
You're not using unix timestamps, but I checked your data, and it appears you're using days since the epoch, so here goes:

awk -F, 'BEGIN{OFS=","} { print $1,$2,$3,$4,strftime("%Y-%m-%d",$5*86400) }' myFile.txt
falstro
  • 34,597
  • 9
  • 72
  • 86