LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 10-31-2004, 05:00 AM   #1
shazam75
Member
 
Registered: Oct 2004
Location: Australia, Brisbane
Distribution: Gentoo
Posts: 296

Rep: Reputation: 30
Question about getting the date/time information from a file


Hi

Is it possible to get the date/time stamp from a file. I want to write a script that looks at each files date and time stamp. Is it possible to get this infor - when you type ls -la
you can see the date/time stamp - how is it possible to get this information and put it in a variable.

Regards
Shelton.
 
Old 10-31-2004, 07:54 AM   #2
neilman
Member
 
Registered: Oct 2004
Location: Northville, MI
Distribution: Slackware
Posts: 65

Rep: Reputation: 15
Here's a jumpstart -- using awk, you can pipe this information into any script -- because now the output is tab delimited in a very nice specific order:

ls -Alt --full-time | awk '{print $11 "\t" $7 "\t" $8 "\t" $9 "\t" $10}'

Output looks like:
Code:
test.txt        Oct     31      08:52:11        2004
.bash_history   Mar     21      12:10:03        2004
And in Perl, you can parse it line by line, splitting it up by tabs, into column vars, etc. I'd love to spend the time writing it for you, but I have to run. :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get file modification date/time in Bash script cmfarley19 Programming 12 01-19-2013 09:37 AM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM
loading data from a flat file with a date and time having a different format spyghost Programming 2 11-02-2003 04:40 PM
Where can I look for the config file for modified date and time ForumKid Linux - General 1 09-19-2003 08:05 AM
Appending current date and time to a file frankietomatoes Linux - General 5 11-18-2002 02:09 PM


All times are GMT -5. The time now is 12:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration