Unix script

Hi
I am relatively new to unix. I need to write a unix script to get all the files which we are not receiving now, but we used to receive 4 months back. Usually we used to receive the files daily but now we are not receiving now.

All the filenames ends with 'in' .

The files displayed should be unique.

Please help :slight_smile:

this will give you all files ends with in which are four months older

Thanks for the reply . This is the error i'm getting .. plz help :slight_smile:

ksh: /usr/bin/find: arg list too long

I think the requirement is a little more complicated than that anyway. If you did want to use find like that you would have to protect the * using '*in'. Also the uniq is pointless since filenames are unique by definition.

How can you tell what date each file is for? Is it included in the filename, or are you going by the last modification date of each file?

Hi,

try out this!
 find . -type f -name *in -mtime +120| sort | uniq 
  \(In Vidyadhar85's solution,it is not -f but simply f and is the type of file\(regular\) and also use 'sort' before applying 'uniq',recommended.\)

Regards
Dileep Pattayath

Hi everyone,

Please help

I have a list of 1000 different files which comes daily to the directory.Some of
the files are not coming to the directory now.

I need to write a shell script to find the latest date and time of the files they
came to the directory. The files should be unique.

All the files ends with 'in'.

The output should somewhat look like this.

aeredrin Sep 1 time
agetrtin Aug 26 time
--------
---------
----------
---------
lkkjijin Mar 27 time
erwitein mar 1 time
--------
--------
--------
-------- and so on ...

Each file as to appear only once in the list

Thanks a lot ..

The -ls option to find (if available) prints the date, size, and owner of each file in addition to the file name, just like the ls command. (You can use -exec ls -l {} \; as a workaround if your find doesn't have the -ls option.)

find /path/to/directory -name '*in' -ls

Like Annihilannic already remarked, file names are unique by definition.