The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Include PERL script with in the unix shell script ganapati UNIX for Dummies Questions & Answers 1 04-29-2008 01:18 PM
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 03:31 PM
FTP script for sending a file from one unix directory to another unix server director raja_1234 Shell Programming and Scripting 1 11-30-2006 07:57 AM
how to convert unix .ksh script to windows .batch script 2.5lt V8 Shell Programming and Scripting 1 11-28-2006 12:52 PM
check in unix shell script so that no one is able to run the script manually adi_bang76 Shell Programming and Scripting 1 11-16-2006 10:43 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-01-2008
karthicss karthicss is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 11
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
  #2 (permalink)  
Old 09-01-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,400
Quote:
find . -type f -name "*in" -mtime +120
this will give you all files ends with in which are four months older

Last edited by vidyadhar85; 09-01-2008 at 03:34 AM..
  #3 (permalink)  
Old 09-01-2008
karthicss karthicss is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 11
Quote:
Originally Posted by vidyadhar85 View Post
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

ksh: /usr/bin/find: arg list too long
  #4 (permalink)  
Old 09-01-2008
DILEEP410 DILEEP410 is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 148
Post

Hi,

try out this!

Code:
 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
  #5 (permalink)  
Old 09-01-2008
karthicss karthicss is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 11
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 ..
  #6 (permalink)  
Old 09-01-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
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?
  #7 (permalink)  
Old 09-01-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.)

Code:
find /path/to/directory -name '*in' -ls
Like Annihilannic already remarked, file names are unique by definition.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:09 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0