If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Extracting a file date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-19-04, 03:51
wht wht is offline
Registered User
 
Join Date: Jan 2004
Location: Gdańsk
Posts: 2
Extracting a file date

Hello

I'm in need of a shell script that would extract a date of a file preferrably in YYYY-MM-DD format.

Wouldn't want to use ls, as it returns rather not shell friendly format.

Perl would be ok, but really would love it done in plain shell. Anybody with anything already completed?

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 01-19-04, 16:40
lelle12 lelle12 is offline
Registered User
 
Join Date: Mar 2003
Posts: 86
Couldnt you use the --timestyle flag for ls? I.e.

ls -l --time-style="+%Y-%m-%d-%H:%M:%S"

HTH
/Lennart
Reply With Quote
  #3 (permalink)  
Old 01-21-04, 04:53
wht wht is offline
Registered User
 
Join Date: Jan 2004
Location: Gdańsk
Posts: 2
Quote:
Originally posted by lelle12
Couldnt you use the --timestyle flag for ls? I.e.

ls -l --time-style="+%Y-%m-%d-%H:%M:%S"

HTH
/Lennart
Thanks for help, but that doesn't work.

It's a HP-UX 11i and ls doesn't support that option
And I can't install other ls version

Still need help...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On