![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| retrieve value from a file | satish@123 | Shell Programming and Scripting | 1 | 05-17-2008 04:40 AM |
| Retrieve data from a file | tpltp | Shell Programming and Scripting | 2 | 03-28-2008 01:36 AM |
| how to retrieve a particular character from a file? | singalla | UNIX for Dummies Questions & Answers | 1 | 02-27-2008 06:05 AM |
| How to retrieve a particular line from a file | vinayap | UNIX for Dummies Questions & Answers | 2 | 07-11-2007 11:16 AM |
| Retrieve message from file | mpang_ | Shell Programming and Scripting | 5 | 02-02-2007 05:38 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi All,
I am involved in a Datawarehousing project where my data files(ASCII text) are loaded on a Unix directory. When I do a Ls -l in Unix prompt i get a file listing along with the timestamp when these files were created/put on the server. I need to retrieve the timestamp associated with each file. Is there any command that takes in the filename as an argument and returns the timestamp associated with it?? Or is there any other way to get the timestamp for each file.. Urgent help is sought!! Thanks in advance.. Nilotpal. |
| Forum Sponsor | ||
|
|
|
|||
|
If you wanted to create a separate file that just had the filename in one column and the 'timestamp' in another...then you'd just use the ls -l command and cut the columns that you want (filename and date time....)
for example if all you files were data_xxx (where xxx differs but they all start with data_) ls -l data_* | cut -c42-100 > my_file Ideally with cut you'd use the -f for fields with the -d for delimiter, however the delimiter is space and the different columns have a different number of spaces as a delimiter. So you can just cut the characters 42-100 (note the 42 may differ so you need to find where the first character you want is..and 100 just goes way past the end to ensure you get all long filenames.) There may be a way to use the -d and -f if you can specify the treat consecutive delimiters as one, however then you'd have to watch for filenames with spaces in them anyway. Anyone know if there is a way with cut to treat consecutive delimiters as one?
__________________
Pete |
|||
| Google The UNIX and Linux Forums |