Find command issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find command issue
# 8  
Old 03-24-2014
provide us the sample content of 'error.logs' file and we can see if we can help you
# 9  
Old 03-24-2014
How does your logging start with? say at the start of the day. Do you have a date field or something similar?
# 10  
Old 03-24-2014
Here u go!!!
Code:
26 Jan 2014 12:06:08,274  INFO  security  - Userid: gabriel, Saved File Instance, Name: [VAP], Registry: [RAP]
16 Feb 2014 12:07:29,605  INFO  security  - Userid: ram, Saved File Instance, Name: [RAS], Registry: [RAP]
26 Feb 2014 12:06:08,274  INFO  security  - Userid: raja, Saved File Instance, Name: [VAP], Registry: [RAP]
26 Feb 2014 12:07:29,605  INFO  security  - Userid: ram, Saved File Instance, Name: [RAS], Registry: [RAP]
24 Mar 2014 12:07:29,605  INFO  security  - Userid: Sri, Deleted File Instance, Name: [RAS], Registry: [RAP]


Last edited by Franklin52; 03-24-2014 at 05:31 AM.. Reason: Please use code tags
# 11  
Old 03-24-2014
Using GNU date

Code:
#!/bin/bash

cmp=$( date +%s -d"1 day ago" )
while IFS=, read data rest
do
  log_time=$( date +%s -d "$data" )
  [[ $log_time -ge $cmp ]] && echo "$data,$rest"
done < error.logs


Last edited by ahamed101; 03-24-2014 at 06:00 AM..
# 12  
Old 03-24-2014
ahamed,

Still it displays the same thing as like a duplicate not the latest one and with the below error.

Usage: date [-u] [+"Field Descriptors"]

---------- Post updated at 03:45 AM ---------- Previous update was at 03:44 AM ----------

date: 0551-402 Invalid character in date/time specification

Last edited by Vinoth Kumar G; 03-24-2014 at 05:44 AM.. Reason: Missed key word
# 13  
Old 03-24-2014
Which is your OS? Check if your date supports +%s option i.e. date +%s
Try changing the first line to if your date supports +%s
Code:
cur=$( date +%s )
(( cmp=cur-(24*60*60) ))

# 14  
Old 03-24-2014
OS : AIX
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue in Find and mv command

Hi I am using the below code to find mv the files. Files are moving to the Target location as expected but find is displaying some errors like below. find ./ -name "Archive*" -mtime +300 -exec mv {} /mnt/X/ARC/ \; find: `./Archive_09-30-12': No such file or directory find:... (6 Replies)
Discussion started by: rakeshkumar
6 Replies

2. Shell Programming and Scripting

Find command issue

Guys, Here is my requirement.. Sample.cfg file="*log.gz *txt.gz" sample.sh #!/bin/sh . $HOME/Sample.cfg find . -name "$file" -mtime +20 -exec ls -la {} \; Its not finding the given *log.gz and txt.gz files. Could anyone please help me? (8 Replies)
Discussion started by: AraR87
8 Replies

3. Shell Programming and Scripting

Performance issue while using find command

Hi, I have created a shell script for Server Log Automation Process. I have used find xargs grep command to search the string. for Example, find -name | xargs grep "816995225" > test.txt . Here my problem is, We have lot of records and we want to grep the string... (4 Replies)
Discussion started by: nanthagopal
4 Replies

4. Linux

find command issue

Hi, I am not root user. I am trying to find the file which has contains pattern "fvsfile" in root directory. If i run the find cmd then i got permission denied and all the files are listed include pattern files. i cant get file name yet find . print | xargs grep -i "fvsfile" I want... (2 Replies)
Discussion started by: Mani_apr08
2 Replies

5. Shell Programming and Scripting

Issue with Find Command

Hi All, I'm a bit new to Linux environment, moderately okay when it comes to Unix AIX. I'm facing an issue while trying to run a simple find command: $ for file in `find . -name *.*` > do > ls $file > done This is throwing the following error: Strangely, a few minutes... (4 Replies)
Discussion started by: adi_2_chaos
4 Replies

6. UNIX for Dummies Questions & Answers

Find command issue

I am currently using below command to get the 1st three characters of a file(PDM). Issue is, when i use find command in root dir, it finds all the files in sub dir also. How to limit the find command search to a given path only(ie: say only find file in apps/cmplus/datamigration/data path... (3 Replies)
Discussion started by: abhi_n123
3 Replies

7. Shell Programming and Scripting

Issue with Find command on Linux

Hi, I am issuing find command below mentioned ways but it givs different count. I don't understand the behaviour. Could any one have any clue? $ find . -mtime -5 -maxdepth 1 -exec ls -lrt {} \; | wc -l 169 $ find . -mtime -5 -maxdepth 1 | wc -l 47 $ find . -mtime -5 -maxdepth 1 | wc -l... (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

8. UNIX for Dummies Questions & Answers

Extrange Find command Issue

Hi all, i'm new at shell scripting world... I'm working on a script for searching old files on a server, this scripts runs with a configuration file wich indicates where to search the files, the script should search for all files that are older than an x qty of days, and the only clue that i have... (9 Replies)
Discussion started by: juanklavera
9 Replies

9. UNIX for Dummies Questions & Answers

Issue with find command using links

Hi, Having a simple issue with find command on Sun. The command works fine if the variable is set to the actual filesystem but fails when the variable is set to a link which is pointing to the same filesystem. export DUMPDEST=/oradata1/exports/pbm - Set the variable ... (2 Replies)
Discussion started by: win_vin
2 Replies

10. Shell Programming and Scripting

An issue with find command.

Hi all, I have a shell script(ksh) which has the code as follows. ------------------ cd $mydir for i in `find ./ -type f -mtime +$k` do echo $i done ----------------------- And in $mydir , i have some files which have space in theie names like "Case att15". The out put of the... (6 Replies)
Discussion started by: rajugp1
6 Replies
Login or Register to Ask a Question