The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to retrieve original contents of a modified file (modified using vi) novice100 UNIX for Dummies Questions & Answers 3 05-31-2007 08:50 PM
list exe files modified before certain dates fremont UNIX for Dummies Questions & Answers 2 05-25-2007 09:29 AM
chmod command for recently modified files polka_friend UNIX for Dummies Questions & Answers 2 08-30-2006 03:25 PM
Julian Dates and the Cal command shan2on Shell Programming and Scripting 0 06-26-2006 05:32 PM
Comparing last modified dates dmilks Shell Programming and Scripting 1 08-16-2005 09:01 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-04-2001
cypher cypher is offline
Registered User
  
 

Join Date: Nov 2001
Posts: 3
Modified dates to a file without the cut command

how can i write the modified dates of all of the files in my directory to a file. i dont want any of the other junk from ls in there. i cant use the cut command
  #2 (permalink)  
Old 12-04-2001
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Why can't you use cut? And do you want the filename with the date of last modification?

  #3 (permalink)  
Old 12-05-2001
TioTony's Avatar
TioTony TioTony is offline Forum Advisor  
Bit Pusher
  
 

Join Date: Oct 2001
Location: Southern California
Posts: 332
Hi Cypher,
You can use this:

ls -sl | awk '{print $9,$10} > file.out

to accomplish what you want. You may have to adjust $9 and $10 depending on your system output. I ran this on Solaris 8. IF you have never used awk, the above statment will essentially copy columns 9 and 10 of the ls -sl output info the log file and nothing else. In my case, column 9 is the time and 10 is the filename. If you don't want the filename, simply remove the ",$10" from above. Also, you could change the ls command from ls -sl to ls -c if you wanted to learn when the file permissions, ownership, etc were last changed. You may have to change 9 and 10 again to compensate for your system output.
  #4 (permalink)  
Old 12-05-2001
subrain subrain is offline
Registered User
  
 

Join Date: Dec 2001
Location: GUANGZHOU CHINA
Posts: 11
Re: Modified dates to a file without the cut command

hi,guey.
you could try like this:

touch <filename>
  #5 (permalink)  
Old 12-05-2001
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Lots o' choices!

Heres another:
(ls -la|while read a b c d e f; do echo $e; done) > myfile

or another, if you want only files (not directories):

find . -type f -exec ls -l {} \; | awk '{print $5}' > myfile
(This is how I personally would do it...)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 03:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0