The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Order files by create date mab_arif16 Shell Programming and Scripting 4 05-15-2006 10:04 AM
How do I organize a series of files in date order? hedgehog001 UNIX for Dummies Questions & Answers 1 08-22-2005 08:04 PM
list of files in date order Jeannine UNIX for Dummies Questions & Answers 2 08-15-2005 11:19 AM
Moving Files within a particular date range rooh UNIX for Dummies Questions & Answers 3 03-18-2002 06:59 AM
Moving files based on creation date dgoyea UNIX for Dummies Questions & Answers 1 06-28-2001 02:43 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-10-2008
Registered User
 

Join Date: Mar 2008
Posts: 1
Sorting Files by date and moving files in date order

I need to build a k shell script that will sort files in a directory where files appear like this "XXXX_2008021213.DAT. I need to sort by date in the filename and then move files by individual date to a working folder. concatenate the files in the working folder then start a process once process is finish then increment by +1 and move the next date to the working folder. Using a AIX box but shortly will be switching to Linux
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-10-2008
rikxik's Avatar
Registered User
 

Join Date: Dec 2007
Posts: 104
Show your code.
Reply With Quote
  #3 (permalink)  
Old 03-11-2008
Registered User
 

Join Date: Feb 2007
Posts: 43
Smile sort by date

You can use sort -k1.??(starting field no),ending filed no.
say for example for your date XXXX_2008021213.DAT to sort this on year
mth and date order you can use
sort -k1.6,1.9 -k1.10,1.11 -k1.12,1.13 input_file > output file
Cheer up
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0