Sponsored Content
Top Forums Shell Programming and Scripting How to find all files other than first two dates & last date per month and year? Post 302898945 by Makarand Dodmis on Friday 25th of April 2014 06:19:27 AM
Old 04-25-2014
How to find all files other than first two dates & last date per month and year?

how to find all files other than first two dates & last date per month and year

Hi All,
lets say there are following files in directory

Code:
-rwxr-xr-x   1 user  userg         1596 Mar 19 2012 a.txt
-rwxr-xr-x   1 user  userg         1596 Mar 19 2012 b.txt
-rwxr-xr-x   1 user  userg         1596 Mar 22 2012 c.txt
-rwxr-xr-x   1 user  userg         1596 Mar 24 2012 d.txt
-rwxr-xr-x   1 user  userg         1596 Mar 25 2012 e.txt
-rwxr-xr-x   1 user  userg         1596 Mar 27 2012 ee.txt
-rwxr-xr-x   1 user  userg         1596 Feb 12 2012 f.txt
-rwxr-xr-x   1 user  userg         1596 Feb 12 2012 g.txt
-rwxr-xr-x   1 user  userg         1596 Feb 22 2012 h.txt
-rwxr-xr-x   1 user  userg         1596 Feb 23 2012 i.txt
-rwxr-xr-x   1 user  userg         1596 Feb 28 2012 j.txt
-rwxr-xr-x   1 user  userg         1596 Feb 28 2012 jj.txt
-rwxr-xr-x   1 user  userg         1596 Apr 02 2013 k.txt
-rwxr-xr-x   1 user  userg         1596 Apr 11 2013 l.txt
-rwxr-xr-x   1 user  userg         1596 Apr 11 2013 m.txt
-rwxr-xr-x   1 user  userg         1596 Apr 23 2013 n.txt
-rwxr-xr-x   1 user  userg         1596 Apr 27 2013 o.txt
-rwxr-xr-x   1 user  userg         1596 Apr 29 2013 oo.txt

i want all files showed in red color

for Mar 2012
first two dates are Mar19 & Mar22
last 1 date is Mar27

for Feb 2012
first two dates are Feb12 & Feb22
last 1 date is Feb28

for Apr 2013
first two dates are Apr02 & Apr11
last 1 date is Apr29

So i want all files in directory other than above dates

output should be:

Code:
-rwxr-xr-x   1 user  userg         1596 Mar 24 2012 d.txt
-rwxr-xr-x   1 user  userg         1596 Mar 25 2012 e.txt
-rwxr-xr-x   1 user  userg         1596 Feb 23 2012 i.txt
-rwxr-xr-x   1 user  userg         1596 Apr 23 2013 n.txt
-rwxr-xr-x   1 user  userg         1596 Apr 27 2013 o.txt

Any help much appreciated!!!

OS: SunOS 5.8 & KSH

Last edited by Makarand Dodmis; 04-25-2014 at 07:57 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script for tar and zip based on month & year

Hi Friends, I'm doing on script which finds all the files with time stamp and makes them tar and zip, based on their respective month&year. for instance "mar-2004.tar.zip" will contain all the files which was created/accessed/modified on mar-2004. like this the entire filesystem should be taken... (1 Reply)
Discussion started by: tuxfello
1 Replies

2. Shell Programming and Scripting

Get yesterday's date in year-month-day format?

Dear All, Actually, i'm doing some reporting job and i need to pass yesterday's date in Year-Month-Day format(e.g. 2009-06-10) to another program for generating 2009-06-10 report. to get today's date, it's easy to just date '+%Y%m%d' , but no idea how can i get this kind of format for... (2 Replies)
Discussion started by: tiger2000
2 Replies

3. Shell Programming and Scripting

how to increment days according to year & month

Hiii i have a file with data as shown below: a.dat: RAO 1900 2 7 0 0 0.00 10.8000 76.8000 10.0 0 0.00 0 6.00 0.00 0.00 0 0.00 6.00 0 NULL LEE 1901 2 15 0 0 0.00 26.0000 100.0000 0.0 0 0.00 0 0.00 0.00 0.00 0 6.00 6.00 0 NULL RAO 1901 4... (3 Replies)
Discussion started by: reva
3 Replies

4. UNIX for Dummies Questions & Answers

Unix man command to find out month of the year?

how can i display month of the year i was born with using man command? thanks (2 Replies)
Discussion started by: janetroop95
2 Replies

5. Shell Programming and Scripting

Julian day to dates in YEAR-MONTH-DAY

hello, I have many files called day001, day002, day003 and I want to rename them by day20070101, day20070102, etc. I need to do it for several years and leap years as well. What is the best way to do it ? Thank you. (1 Reply)
Discussion started by: Ggg
1 Replies

6. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

7. UNIX for Advanced & Expert Users

Find all files other than first two files dates & last file date for month

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (16 Replies)
Discussion started by: Makarand Dodmis
16 Replies

8. Shell Programming and Scripting

How to find all files for same month and year?

Hi All, I find all files for same month and year lets say there are following files in directory -rwxr-xr-x 1 user userg 1596 Mar 19 2012 c.txt -rwxr-xr-x 1 user userg 1596 Mar 21 2012 d.txt -rwxr-xr-x 1 user userg 1596 Mar 22 2012 f.txt -rwxr-xr-x 1... (8 Replies)
Discussion started by: Makarand Dodmis
8 Replies

9. Shell Programming and Scripting

How to find all files other than last two dates per month and year?

Hi All, lets say there are following files in directory -rwxr-xr-x 1 user userg 1596 Mar 19 2012 a.txt -rwxr-xr-x 1 user userg 1596 Mar 19 2012 b.txt -rwxr-xr-x 1 user userg 1596 Mar 22 2012 c.txt -rwxr-xr-x 1 user userg 1596 Mar 24 2012 d.txt... (16 Replies)
Discussion started by: Makarand Dodmis
16 Replies

10. UNIX for Beginners Questions & Answers

How bash treats literal date value and retrieve year, month and date?

Hi, I am trying to add few (say 3 days) to sysdate using - date -d '+ 3 days' +%y%m%d and it works as expected. But how to add few (say 3 days) to a literal date value and how bash treats a literal value as a date. Can we say just like in ORACLE TO_DATE that my given literal date value... (2 Replies)
Discussion started by: pointers1234
2 Replies
XCALPR(1)						      General Commands Manual							 XCALPR(1)

NAME
xcalpr - print xcal calendar entries SYNTAX
xcalpr [ -c ][ -x ][ -f file ][ -d dir ][ -u user ][ date-spec ] DESCRIPTION
Xcalpr prints the contents of the xcal files. It is intended to be used in situations when you have no access to an X screen. It can also be used to generate entries for the standard UNIX calendar program. With no arguments, it prints any entries that exist for the next seven days. The program also reads the contents of the seven daily files and prints them at the appropriate point in the output stream. Each line in the output is preceded by the day of the week, the day of the month, the month and the year. Xcalpr can be given a date specification to select months and years. If the date spec consists of just a year number, then all the data for that year is printed. For example: xcalpr 1994 will print all the data for 1994. Several years can be specified. If you give the name of a month, then the data for that month in the current year will be printed. If the month is in the past, then the data for that month next year will be printed. For example, if xcalpr oct jan is typed in August, xcalpr will print October in the current year and January next year. You can select a particular year by adding the number after any months that you need printing: xcalpr oct nov 1994 will print October and November in 1994. There are a couple of special `month' names. The name rest will print the data for the rest of the month, starting tomorrow. The rest argument is not recognised if you give a year as a parameter. If tomorrow happens to be the first day of the next month, then all the data for next month will be printed. The name next prints all the data for next month. OPTIONS
The -c option causes xcalpr to output lines suitable for input to the standard UNIX calendar program. The -d switch is followed by a directory name and specifies an alterative location for your Calendar directory. Your home directory is prepended if the name doesn't start with a slash or a dot. The -f option is followed by a file name and xcalpr will write it's output to that file, rather than standard output. The -u option is followed by a user name and dumps their calendar files rather than yours. The -x option makes xcalev operate with Calendar files that are compatible with the xcalendar program. FILES
$HOME/Calendar/* xc<dd><Mon><Year> A data file is day, Month in three letter format and the year. xy<Year> A year directory. xw<Day> A data file for the weekly code, one per day. SEE ALSO
xcal(1), xcalev(1), xcal_cal(1) AUTHOR
Copyright 1993 by Peter Collinson, Hillside Systems All rights reserved. This product includes software developed by the University of California, Berkeley and its contributors. X Version 11 R5 October 1993 XCALPR(1)
All times are GMT -4. The time now is 03:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy