LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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
  Search this Thread
Old 10-31-2004, 06: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, 08: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 On
HTML code is Off



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration