command to display filenames for a particular month

command to display filenames for a particular month

Post by marcus_c.. » Fri, 03 Nov 2000 17:52:26



Can someone share with me the command to display the file name for a
particular month?

eg

-rw-r--r--   1 xxx  abc         6448 Aug 2 15:14 GEOFFREY.3585
-rw-r--r--   1 yyy  xyz          923 Aug 16 15:46 EUGENE_W.3586
-rw-r--r--   1 yyy  xyz      2639637 Aug 24 16:00 LI_MEI.3587
-rw-r--r--   1 xxx  abc          923 Sep 1 16:01 HOSHIN_C.3588
-rw-r--r--   1 yyy  xyz          923 Sep 8 16:04 HOSHIN_C.3589

If i want to select month of Aug, I would expect the output would be
GEOFFREY.3585
EUGENE_W.3586
MEI.3587

thanks
Marcus

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

command to display filenames for a particular month

Post by David Hasset » Fri, 03 Nov 2000 22:36:38



> Can someone share with me the command to display the file name for a
> particular month?

> eg

> -rw-r--r--   1 xxx  abc         6448 Aug 2 15:14 GEOFFREY.3585
> -rw-r--r--   1 yyy  xyz          923 Aug 16 15:46 EUGENE_W.3586
> -rw-r--r--   1 yyy  xyz      2639637 Aug 24 16:00 LI_MEI.3587
> -rw-r--r--   1 xxx  abc          923 Sep 1 16:01 HOSHIN_C.3588
> -rw-r--r--   1 yyy  xyz          923 Sep 8 16:04 HOSHIN_C.3589

> If i want to select month of Aug, I would expect the output would be
> GEOFFREY.3585
> EUGENE_W.3586
> MEI.3587

For a simple approach that will work in most cases (it will fall foul if
any file is called 'Aug', or the file names contain spaces, or if the
output of ls is different (e.g. for 'ls /dev'): but lets not over
complicate at first ;-) ), try:

ls -l | awk '{ if (/\<Aug\>/) print $9 }'

 
 
 

command to display filenames for a particular month

Post by Achim Bursia » Fri, 03 Nov 2000 22:38:23



> Can someone share with me the command to display the file name for a
> particular month?

> eg

> -rw-r--r--   1 xxx  abc         6448 Aug 2 15:14 GEOFFREY.3585
> -rw-r--r--   1 yyy  xyz          923 Aug 16 15:46 EUGENE_W.3586
> -rw-r--r--   1 yyy  xyz      2639637 Aug 24 16:00 LI_MEI.3587
> -rw-r--r--   1 xxx  abc          923 Sep 1 16:01 HOSHIN_C.3588
> -rw-r--r--   1 yyy  xyz          923 Sep 8 16:04 HOSHIN_C.3589

> If i want to select month of Aug, I would expect the output would be
> GEOFFREY.3585
> EUGENE_W.3586
> MEI.3587

ls -l | perl -lane 'print $F[8] if $F[5] eq "Aug"'

  or, if you prefer awk (or are poor enough not to have perl):

ls -l | awk '$6=="Aug" { print $9 }'

---
Achim Bursian / Siemens AG, A&D MC E35 / Tel.: +49-9131-98-3759

"Anyone who can't laugh at himself is not taking life seriously
enough."  
                                           (Larry Wall, creator of Perl)

 
 
 

command to display filenames for a particular month

Post by Peter Sundstro » Sat, 04 Nov 2000 05:57:15



Quote:> Can someone share with me the command to display the file name for a
> particular month?

> eg

> -rw-r--r--   1 xxx  abc         6448 Aug 2 15:14 GEOFFREY.3585
> -rw-r--r--   1 yyy  xyz          923 Aug 16 15:46 EUGENE_W.3586
> -rw-r--r--   1 yyy  xyz      2639637 Aug 24 16:00 LI_MEI.3587
> -rw-r--r--   1 xxx  abc          923 Sep 1 16:01 HOSHIN_C.3588
> -rw-r--r--   1 yyy  xyz          923 Sep 8 16:04 HOSHIN_C.3589

> If i want to select month of Aug, I would expect the output would be
> GEOFFREY.3585
> EUGENE_W.3586
> MEI.3587

Not foolproof, but will work for most situations:

ls -l | awk '/Aug / {print $NF}'

 
 
 

1. Capturing an a filename that contains the month/date in filename ie fileMMDD

I am trying to capture a filename that is named "fileMMDD" (MM=month,
DD=day).

Everyday this filename will be change to the current date. However, I need
to ftp this file to another server and when it is on the other server I have
to rename that file "fileMMDD.done" . I can do the ftp part and could do
this entire process only if I knew the exact name of the filename.

The directory that this file is located in will contain upto 30 other files
with the same file naming convention, but they will each a a differnt date,
ie. file0805, file0809, file0810, etc...

Any suggestions would be most appreciated.

2. More on the clock thing

3. Any command to display a filename without extension?

4. master needed... for a CardBUS card

5. How to remove files for a particular month

6. variables and child shells

7. How to search filenames for two words in no particular order?

8. Good email client for Gnome.

9. Get a part of filename : in particular the extension

10. command > filename when command needs keyboard input - HOW?

11. How can i run particular process on particular processor

12. display particular line in a file

13. Crontab field 3, day of month, 1-31, what if month has 30 days?