Filtering Log file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Filtering Log file
# 1  
Old 02-07-2009
Filtering Log file

Hi,


Iam trying to filter a log file in the below format

|fffff|hhhhh|ffff|dd|mm|yy|hh|min||dd|mm|yy|hh|min


the first set of |dd|mm|yy|hh|min is when the application ran
the second set of |dd|mm|yy|hh|min when it ended.


I will be removing the last of the months in the log file to keep it growing.

For instance if in this month I ran the script I will remove November 2008 assuming I keep three months log.


I have used awk but it is somehow jumbling up records towards the end though it is working.

Is there a way to use grep based on fields??

I will be filtering on the mm|yy fields in the first set.

Appreciate your repsonse.
# 2  
Old 02-09-2009
i believe you could use:

Code:
grep -v "^|..|11|08|" log_in > log_out
mv log_out log_in

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with filtering records in a file

Hi, I have following records in a file more file1.txt setting applicaction ABC for user setting applicaction CDE for user setting applicaction XXX for user logging applicaction XXX for user I need to filter out records which have strings " setting... (5 Replies)
Discussion started by: manid
5 Replies

2. Shell Programming and Scripting

Filtering log file with lines older than 10 days.

Hi, I am trying to compare epoch time in a huge log file (2 million lines) with todays date. I have to create two files one which has lines older than 10 days and another file with less than 10 days. I am using while do but it takes forever to complete the script. It would be helpful if you can... (12 Replies)
Discussion started by: shunya
12 Replies

3. Shell Programming and Scripting

PERL "filtering the log file removing the duplicates

Hi folks, I have a log file in the below format and trying to get the output of the unique ones based on mnemonic IN PERL. Could any one please let me know with the code and the logic ? Severity Mnemonic Log Message 7 CLI_SCHEDULER Logfile for scheduled CLI... (3 Replies)
Discussion started by: scriptscript
3 Replies

4. Shell Programming and Scripting

Filtering first file columns based on second file column

Hi friends, I have one file like below. (.csv type) SNo,data1,data2 1,1,2 2,2,3 3,3,2 and another file like below. Exclude data1 where Exclude should be treated as column name in file2. I want the output shown below. SNo,data2 1,2 2,3 3,2 Where my data1 column got removed from... (2 Replies)
Discussion started by: ks_reddy
2 Replies

5. UNIX for Dummies Questions & Answers

Filtering records from 1 file based on some manipulation doen on second file

Hi, I am looking for an awk script which should help me to meet the following requirement: File1 has records in following format INF: FAILEd RECORD AB1234 INF: FAILEd RECORD PQ1145 INF: FAILEd RECORD AB3215 INF: FAILEd RECORD AB6114 ............................ (2 Replies)
Discussion started by: mintu41
2 Replies

6. Shell Programming and Scripting

filtering the log file

Hi i have a log file like example below. I need only one field from below log all other need to be truncated from the log file. 2011-06-13 15:10:53,498 INFO ext.SP->CAL (log point 5) can any body help on this please. Thanks (4 Replies)
Discussion started by: mostwantedkisss
4 Replies

7. Shell Programming and Scripting

filtering the rows in a file

hi all, please help on this isssue, i have a file which contains something like this and i want to seprate the servers which has vasd.pid ,i need only server names. i want output something like this which vasd.pid . server1 server3 server4 (4 Replies)
Discussion started by: sudharson
4 Replies

8. UNIX for Dummies Questions & Answers

Filtering a file

I have a list of directories looking something like; /usr/local/1/in /usr/local/1/out /usr/local/1/archive /usr/local/2/in /usr/local/2/out /usr/local/2/archive /usr/local/3/in /usr/local/3/out /usr/local/3/archive Is there a way I can filter the out and archive directories so I... (5 Replies)
Discussion started by: JayC89
5 Replies

9. Shell Programming and Scripting

Filtering the yesterdays date from log files via script.

hi All, I have this sample text file - access.log: Jan 18 21:34:29 root 209.151.232.70 Jan 18 21:34:40 root 209.151.232.70 Jan 18 21:34:43 root 209.151.232.70 Jan 18 21:34:56 root 209.151.232.70 Jan 18 21:35:10 root 209.151.232.70 Jan 18 21:35:23 root 209.151.232.70 Jan 18 21:36:04 root... (2 Replies)
Discussion started by: linuxgeek
2 Replies

10. Shell Programming and Scripting

Filtering line out of file

Hy, I would like to extract lines within following file, 4TX + 4XFUT + 4XBACK + 4Xexp: theo. actual start of day: -2 5 end of day: 5 4 profit: 2 -1 ==================== trade profit: 9 -2... (9 Replies)
Discussion started by: sam786
9 Replies
Login or Register to Ask a Question