Identifying .log files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Identifying .log files
# 1  
Old 04-30-2014
Identifying .log files

Hi. Is there a way to:

1) produce a listing of .log files
2) older than 5 years of age
3) that includes the full path and filename together with one file per line

Any help producing such a script would be very helpful. Thanks.
# 2  
Old 04-30-2014
try

Code:
find . -type f -name "*.log" -mtime +1825

Considering 365 day a year; i have used 1825 days for 5 years

for full path

Code:
var=`pwd`
find $var -type f -name "*.log" -mtime +1825


Last edited by Makarand Dodmis; 04-30-2014 at 12:44 PM..
This User Gave Thanks to Makarand Dodmis For This Post:
# 3  
Old 04-30-2014
Thank you. The first option seems to work, but the second gives no output. I'll try to work with the first options. I appreciate your time.

Quote:
Originally Posted by Makarand Dodmis
try

Code:
find . -type f -name "*.log" -mtime +1825

Considering 365 day a year; i have used 1825 days for 5 years

for full path

Code:
var=`pwd`
find $var -type f -name "*.log" -mtime +1825

# 4  
Old 04-30-2014
if first option is working ; second should work...
second option contains two commands...
have you ran in the same sequence
Code:
var=`pwd`

followed by
Code:
find $var -type f -name "*.log" -mtime +1825

Also you can put these both commands in one test.sh and run ./test.sh

Code:
var=`pwd`
find $var -type f -name "*.log" -mtime +1825

This User Gave Thanks to Makarand Dodmis For This Post:
# 5  
Old 04-30-2014
Yes, I did try creating a shell script to run both commands. For whatever reason I get no ouput when running the script versus the single command. A bit perplexing. Regardless, I appreciate your help.

Quote:
Originally Posted by Makarand Dodmis
if first option is working ; second should work...
second option contains two commands...
have you ran in the same sequence
Code:
var=`pwd`

followed by
Code:
find $var -type f -name "*.log" -mtime +1825

Also you can put these both commands in one test.sh and run ./test.sh

Code:
var=`pwd`
find $var -type f -name "*.log" -mtime +1825

# 6  
Old 04-30-2014
try

Code:
var=$(pwd)

# 7  
Old 05-01-2014
yes for full path try with
Code:
find $(pwd) -type f -name "*.log" -mtime +1825

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Identifying all the 3rd party software/executable files in RHEL 5.6

I have used yum list installed and rpm -qa commands. But these provide only the source packages, I want the specific software name. And how to identify any software that is installed without the yum or rpm package system. I tried compgen -c but it doesn't works with rhel5.6 (1 Reply)
Discussion started by: PrabhaPatra4567
1 Replies

2. Shell Programming and Scripting

Redirecting log files to null writing junk into log files

Redirecting log files to null writing junk into log files. i have log files which created from below command exec <processname> >$logfile but when it reaches some size i am redirecting to null while process is running like >$logfile manually but after that it writes some junk into... (7 Replies)
Discussion started by: greenworld123
7 Replies

3. Shell Programming and Scripting

Identifying files with a timestamp greater than a given timestamp

I need to be able to identify files with file timestamps greater than a given timestamp. I am using the following solution, although it appears to compare files at the "seconds" granularity and I need it at the milliseconds. When I tested my solution, it missed files that had timestamps... (3 Replies)
Discussion started by: nkm0brm
3 Replies

4. Shell Programming and Scripting

The -f switch is not identifying files[solved]

(1 Reply)
Discussion started by: lowExpectations
1 Replies

5. Shell Programming and Scripting

How can view log messages between two time frame from /var/log/message or any type of log files

How can view log messages between two time frame from /var/log/message or any type of log files. when logfiles are very big and especially many messages with in few minutes, I would like to display log messages between 5 minute interval. Could you pls give me the command? (1 Reply)
Discussion started by: johnveslin
1 Replies

6. Shell Programming and Scripting

Identifying a string from a set of files and printing to a new file

Dear All, I'm an amateur to writing scripts and need to do the following Need to read all files with a .log extension in a directory and identify the value for username i.e. all files have something like username = John. Once this is read, I need to print this value to a new file. The new file... (2 Replies)
Discussion started by: Kelly_B
2 Replies

7. UNIX for Dummies Questions & Answers

identifying core dump files.

I have come into a business environtment problem and had been 10+ years since the last time I did any unix admin work. A long time ago some mainframe person created an app that talked to a mainframe on UNIX and wrote a c program with "core" in the file name to indicate that the file was the... (2 Replies)
Discussion started by: pcooke2002
2 Replies

8. Shell Programming and Scripting

Identifying New and Modified Files/Directories

Hi. Our shop is migrating to a new UNIX server and our hope is to do a full migration of all files to the new server weeks in advance of the final migration. As a result we want to identify files on our SOLARIS 8 UNIX server that have changed or that were created after a specific date & time... (2 Replies)
Discussion started by: buechler66
2 Replies

9. Shell Programming and Scripting

Identifying 30 days old files and copy..

I want to copy last 30days old files from one location to another. Please help me to list the last 30 days files and copy the last 30 days files from the current list. (1 Reply)
Discussion started by: formanikandan
1 Replies

10. Shell Programming and Scripting

Identifying RF users

HP-UX All, I work in a manufacturing environment where some users connect to our Progress-based system with wireless RF units (Bar-code). Sometimes they go out of range and get disconnected but their session remains alive (ghost sessions). This sometimes causes record lock problems and is a pain.... (6 Replies)
Discussion started by: rm-r
6 Replies
Login or Register to Ask a Question