1

hi i have this file on my UNIX box (SunOS 5.10).

-rwxr-xr-x   1 phnxep  siebel 917 Feb  1 02:52 crontest.sh

Here date and time are given like Feb1 02:52.Can i just read these values in UNIX for my file ignoring the rest of the details.In the required format-:

2017-02-1 02:52

And convert them to integer values later on???Please help guys i am really stuck on this.

Randomguy
  • 192
  • 1
  • 11

1 Answers1

1

If you are using gnu ls, try

ls -l --time-style=full-iso

E.g.:

$ touch x
$ ls -l --time-style=full-iso x
-rw-r--r-- 1 max max 0 2017-02-06 13:18:56.498920000 +0000 x

If you are using Sun ls, try -E option, e.g. ls -E.

Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271