Unix Command to separate this years files and last years?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unix Command to separate this years files and last years?
# 1  
Old 06-21-2010
Unix Command to separate this years files and last years?

Hello - I have a folder that contains files from 2003 till 2010. I am trying to figure out a command that would seperate each years file and show me a count?

Even if i can find a command that would give me year by year count, thats good enough too.

Thanks
# 2  
Old 06-21-2010
Question Need more info

Can you supply an example of the files? That will make it possible to provide a command, or set of commands, to accommodate your request?
Are you looking to separate by filename, or by last edit (or other) date?
# 3  
Old 06-21-2010
I am trying to figure out how many files were created each year. And if possible, break down by each month of that year.

The file formats are different. Such as these:

Systemerror-1-8-2010 7_00_06 PM.xml (PM remains constant)

2004-01-08.txt

DATE2007-02-12.txt
# 4  
Old 06-21-2010
Hi,

you can use something as :

Code:
#ls -lrth|awk '$8 == 2003 {print}'|wc -l

then change 2003 with 2004,2005,2006... etc.

Smilie
This User Gave Thanks to Reboot For This Post:
# 5  
Old 06-21-2010
This is good.. till i put 2010 and it shows 0. Although i have 2010 files..

And is there a way for me to break month by month..
# 6  
Old 06-21-2010
Files less than 6 months old show the time of day instead of the year.
# 7  
Old 06-21-2010
No time to post an example. The technique is to create reference files with "touch" with specific timestamps (e.g 31 Dec 2009 23:59) then use "find -newer reference_file_name". By building "and not" conditions in "find" it is possible to define year ranges or any other timespan.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

The Dark Years of UNIX (2003 - 2011) | A Decade Lost to Legal Battles | YouTube Video

The Dark Years of UNIX (2003 - 2011) | A Decade Lost to Legal Battles | UNIX and Linux Legal Attacks https://youtu.be/ILH5CVYdl8w Here is the second video in the "history of unix" short videos. The first video was on the "great history of UNIX" and this second video covers the "years of... (7 Replies)
Discussion started by: Neo
7 Replies

2. What is on Your Mind?

The Great History of UNIX (1969-1999) | 30 Years of UNIX History | YouTube Video

I am pleased to announce this new video in 1080 HD for UNIX lovers honoring thirty years of UNIX history spanning from 1969 to 1999 presented in 150 seconds (two and a half minutes) in 1080 HD, celebrating the 50th anniversary of UNIX. The Great History of UNIX (1969-1999) | 30 Years of UNIX... (8 Replies)
Discussion started by: Neo
8 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Delete files older than 10 years

I need a command which delete files older than 10 years. I got a command for 90 days and all commands I find are for days and nothing for years. find file_name -mtime +90 -exec rm {} \; (5 Replies)
Discussion started by: eskay
5 Replies

4. UNIX for Dummies Questions & Answers

Interview topics or questions for unix developers with 4.years experience

Hi , I am gonna attend interview this week end for unix developer ( 4.5 years exp) opening .. Can you help me out the topics or the questions which I can expect in the interview. This is may be silly but it is very important to me. Thanks in Advance (5 Replies)
Discussion started by: arukuku
5 Replies

5. Shell Programming and Scripting

Need to Zip files three years old or longer but leave folder structure intact

Hi all, Hello everyone, my first post here :). I tried to search the forum but I didn't find exactly what I was looking for... I need to zip/tar files across entire filesystem which are more 3+ years old but leave folder structure intact. If the script locates tar/zip files they are more... (1 Reply)
Discussion started by: sashruby
1 Replies

6. Shell Programming and Scripting

unix korn shell leap years problem

Write a function called dateToDays that takes three parameters -a month string such as Sep, a day number such as 18, and a year number such as 1962-and return s the number of days from January 1, 1900, to the date. Notes: I am asking you to account for leap years. my script is not... (0 Replies)
Discussion started by: babuda0059
0 Replies

7. Shell Programming and Scripting

Easy unix/sed question that I could have done 10 years ago!

Hi all and greetings from Ireland! I have not used much unix or awk/sed in years and have forgotten a lot. Easy enough query tho. I am cleansing/fixing 10,000 postal addresses using global replacements. I have 2 pipe delimited files , one is basically a spell checker for geographical... (4 Replies)
Discussion started by: dewsbury
4 Replies

8. UNIX for Dummies Questions & Answers

Archiving Files by selecting years file created

I have recently taken on a new position and want to clean up several file locations that currently hold data back through 1999. While I need to keep this data for business reasons, I have created directories to help sort out the individual years. Is there a quick command that I can use to archive... (2 Replies)
Discussion started by: dmhammond
2 Replies

9. Cybersecurity

Unix attacks in the last 5 years.

Hi, Could anyone direct me to any sites that have any info on unix attcks or hacks in the last 5 years. This is needed for an assignment. All help would be greatly appreciated. Thanks:) (6 Replies)
Discussion started by: suzant
6 Replies
Login or Register to Ask a Question