Sort files by date, not showing files from today


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sort files by date, not showing files from today
# 1  
Old 07-17-2008
Sort files by date, not showing files from today

Hi all,

i'm new here in this forum. I really like the helpful answers in this forum.

Here a short question.
For a script i have to sort files by date and exclude the files of the actual date.

Sorting the files by date and preparing the output for awk is done by this line:

ls -l Transfer*.log | awk '{ print $6 $7"08 " $9}' | sort -k 1,1 | awk '{print do my comand}' | csh

Is there a easy way to extend this one liner to exclude files of the actual day.

Many thanks for all you input.
Smilie Carlos Di Vega
# 2  
Old 07-17-2008
Maybe just do
Code:
find . -type f -name "Transfer*.log" -mtime +1 -print

Not sure if you want it being recursive, else just -prune it.
# 3  
Old 07-17-2008
Hi zaxxon!

Many thanks for your fast reply. Your solution will do the trick.

Smilie Carlos Di Vega
# 4  
Old 07-17-2008
ls -lt | grep -v "$(date '+%b %d')"

depending on the way ls -l date is displayed, may need to manipulate the date format ..

you can sort reverse by
ls -ltr | grep -v "$(date '+%b %d')"
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Csv files sort by date and zip monthly

Hi, I'm an absolute beginner in shell programming. I would need a script for a NAS that makes the csv files sorted by date and always monthly a zip. In the current month, the data should be integrated into this folder, so there are only monthly files. Thanks for your help (1 Reply)
Discussion started by: Pipo
1 Replies

2. Shell Programming and Scripting

Search files with today date and files come anytime in between 10 pm to 1 am

Hi, i want to make script. In a directory everyday( exclude sat and sun) in between 10 pm to 1 am there are 2 files comes and when file comes it will mail us. Format for files is mentioned below. please help me on making this, and also have year end consider and if files come after 12 am it... (6 Replies)
Discussion started by: pallvi_mahajan
6 Replies

3. Shell Programming and Scripting

Move all files except sys date (today) files in Solaris 10

I want to move all files from one directory to another directory excluding today (sysdate files) on daily basis. file name is in pattern file_2013031801, file_2013031802 etc (2 Replies)
Discussion started by: khattak
2 Replies

4. Shell Programming and Scripting

Shell Scripting: Copy Files with Today's date

I was wondering the best way about finding files that were created today and copy them to a directory (grep ?). There can be multiple files for todays date or none. I am looking to copy all of the .lis files for todays date. I may need to modify the filename to include todays date but for the... (4 Replies)
Discussion started by: smkremer
4 Replies

5. Shell Programming and Scripting

Sort files by date in filename

Hi, I am a newbie to shell programming and I need some help in sorting a list of files in ascending order of date in the filenames. The file format is always : IGL01_AC_D_<YYYYMMDD>_N01_01 For example, in a directory MyDirectory I have the following files: IGL01_AC_D_20110712_N01_01.dat... (11 Replies)
Discussion started by: Yuggy
11 Replies

6. Shell Programming and Scripting

Showing files that were created at a certain Date

Guys i am having a bit of a trouble finding the creation date of a file. What i have to do is to redirect the output of a command (which i believed was ls -l but this command shows only the Modification time) into a file, which will contain all the files that were created on a certain date, for... (2 Replies)
Discussion started by: jimas13
2 Replies

7. Shell Programming and Scripting

How to sort a set of files by date in a directory?

hi there, I have a directory which contents I can parse dynamically. I end up with a file list. I then want to display those files sorted by date, oldest files first. I have very very little PERL experience...Would anyone know how to do that ? Thanks in advance. (8 Replies)
Discussion started by: alexf
8 Replies

8. Shell Programming and Scripting

Script to copy log files with today's date

I am a newbie to scripting. I need a korn shell script to copy log files of current day to archive folder and rename with current days date stamp. I would really appreciate your help. File structure is as follows. Everyday files get overwritten, so I need copy to a archive directory and... (3 Replies)
Discussion started by: mdncan
3 Replies

9. Shell Programming and Scripting

How to Sort files on date field

:cool: Hi all, I have a pecular issue in sorting these files in Solaris environment. All the below files are modified on November 4th, but I want to sort these files as per date column (eg: 01May07_1623 = ddmmmyy_hhmm) Nov 4 18:27 SONYELEC00.GI22973.01May07_1623.gpg Nov 4 18:27... (4 Replies)
Discussion started by: shivaastrogun
4 Replies

10. Linux

sort files by date

Hi All, Sorry to throw this frequent question but I lost my notes on it. How do you list the files by date? I'm on red hat. Thanks in advance, itik (1 Reply)
Discussion started by: itik
1 Replies
Login or Register to Ask a Question