Sponsored Content
Top Forums Shell Programming and Scripting How to find all files for same month and year? Post 302898485 by vgersh99 on Tuesday 22nd of April 2014 11:48:25 AM
Old 04-22-2014
Code:
ls -l | awk '{idx=$(NF-3) FS $(NF-1);a[idx]=a[idx]?a[idx] ORS $0:$0}END {for (i in a) print i ORS a[i] ORS}

Code:
Feb 2012
-rwxr-xr-x   1 user  userg         1596 Feb 12 2012 q.txt
-rwxr-xr-x   1 user  userg         1596 Feb 21 2012 a.txt
-rwxr-xr-x   1 user  userg         1596 Feb 22 2012 s.txt
-rwxr-xr-x   1 user  userg         1596 Feb 23 2012 k.txt
-rwxr-xr-x   1 user  userg         1596 Feb 27 2012 j.txt

Mar 2012
-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 user  userg         1596 Mar 24 2012 h.txt
-rwxr-xr-x   1 user  userg         1596 Mar 25 2012 w.txt

Apr 2014
-rwxr-xr-x   1 user  userg         1596 Apr 12 2014 q.txt
-rwxr-xr-x   1 user  userg         1596 Apr 21 2014 a.txt
-rwxr-xr-x   1 user  userg         1596 Apr 22 2014 s.txt
-rwxr-xr-x   1 user  userg         1596 Apr 23 2014 k.txt
-rwxr-xr-x   1 user  userg         1596 Apr 27 2014 j.txt

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

find files with a perticular year of access

Hello all, Might be a silly question, on my AIX machine the year had changed to 2022 and some files were accessed on this date hence the time stamp on these files is with year 2022, there are many such files. i want to list all these file from the root dir and subdir with 2022 year... (3 Replies)
Discussion started by: pradeepmacha
3 Replies

2. UNIX for Advanced & Expert Users

how to get the last month and year in UNIX

how to get the last month and year in UNIx (2 Replies)
Discussion started by: Vijay06
2 Replies

3. Shell Programming and Scripting

Concatenating Files In A Year/Month/Day File Structure

Hi Im trying to concatenate a specific file from each day in a year/month/day folder structure using Bash or equivalent. The file structure ends up like this: 2009/01/01/products 2009/01/02/products .... 2009/12/31/products The file I need is in products everyday and I need the script to... (3 Replies)
Discussion started by: Grizzly
3 Replies

4. Programming

Interval year to month

Hi, I'm working on a Informix4gl module. I'm just trying to find out any built-in function to fetch only the year/month from an INTERVAL YEAR TO MONTH data value. Please let me know, if there are any functions to do this. If not, let me know for any alternative solutions to attain this. ... (5 Replies)
Discussion started by: dvah
5 Replies

5. Shell Programming and Scripting

want to get last year and month from the file

Hi I have files like abc_cd_20110302_123423 abc_cd_ef_20110301_123423 abc_cd_ef_20110403_123423 abc_ef_20110401_123423 I want to extract the the year and month associated with each file. I tried logfileyearmonth=`echo $logfile | awk -F_'{print $NF}'` Any other way can I... (6 Replies)
Discussion started by: dgmm
6 Replies

6. 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

7. 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

8. 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

9. Shell Programming and Scripting

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 -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 ... (6 Replies)
Discussion started by: Makarand Dodmis
6 Replies

10. 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
PSCAL(1)						      General Commands Manual							  PSCAL(1)

NAME
pscal - generates postscript showing your calendar for given year and month SYNOPSIS
: pscal [ -Pprinter ] [ -R ] [ -r ] [ -t ] [ -d directory ] [ other printer flags ] [ month [ year ] ] DESCRIPTION
: Pscal generates the Postscript showing a calendar for the specified month and year. The year, if omitted, defaults to the current year. If both month and year are omitted, the current month is printed. Year can be between 1753 and 9999. The month is a number between 1 and 12. I can also be a three letter month abbreviation. The calendar can be loaded with information from the user. The information either comes in an `Event' file or can be derived from files under the user's Calendar directory should this exist. The search for this data is as follows, if any of these succeeds the data for the calendar is taken from that source. 1) The shell variable EFILE may be set to the name of an Event file. 2) An event file called `Event' may exist in the current directory. 3) The file $HOME/.holiday may exist and contain a list of events. 4) The directory $HOME/Calendar (or a different directory specified with the -d option) may exist containing XCal files. An event file should consist of lines of the form month:day:message string Messages should be 20 characters or less, with no more than 6 messages per day. No spaces should appear from the beginning of a line until after the second colon. Month and day should be numbers in the obvious ranges. OPTIONS
-Pprinter The printer may be specified with the usual -Pprinter syntax. -r The calendar page is printed in ``landscape'' orientation (the default). -R The calendar page is printed in ``portrait'' orientation; this yields a slightly smaller image and may be more suitable for embedding into other documents. -d directory Use the given directory instead of $HOME/Calendar. -t Causes the PostScript to be sent to the standard output, rather than to the printer. This is useful if you wish to save the out- put in a file, or if you want to use options with the lpr(1) command. -F font Sets the font family for the title text (the month and year). -f font Sets the font family for the day-of-month numbers. Other arguments starting with `-' are passed through to lpr(1). Any argument whose first character is '-' is passed on to lpr. The shell variables BANNER, LFOOT, CFOOT, and RFOOT become a top centered banner, and left, centered, or right justified footers respectively. As in: BANNER="Schedule 1" CFOOT=Preliminary pscal 4 90 AUTHOR
Patrick Wood Copyright (C) 1987 by Pipeline Associates, Inc. Permission is granted to modify and distribute this free of charge. HISTORY
Original From: patwood@unirot.UUCP (Patrick Wood) Shell stuff added 3/9/87 by King Ables Made pretty by tjt 1988 Holiday and printer flag passing hacks added Dec 1988 by smann@june.cs.washington.edu Used the better looking version with 5 rows of days rather than 6 hacked together with holiday and banner/footnotes added by Joe (No Rela- tion) Wood, 12/89, jlw@lzga.ATT.COM BUGS
`Pscal' doesn't work for months before 1753 (weird stuff happened in September, 1752). A better format for the dates of holidays would be nice. An escape to allow holiday messages to be raw PostScript would also be nice. The holiday messages should be handled more intelligently (ie, the messages should be clipped to the day). 8/January/1990 PSCAL(1)
All times are GMT -4. The time now is 08:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy