Command needed to Parse Catalina.out in Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command needed to Parse Catalina.out in Linux
# 8  
Old 05-25-2009
If you have Python, and assuming May 26 is what comes after.
Code:
#!/usr/bin/env python
f=0
for line in open("file"):
    if "May 26" in line: break
    if "May 25" in line: f=1
    if f: print line.strip()

output
Code:
# ./test.py
May 25, 2009 1:30:25 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/27 config=null
May 25, 2009 1:30:25 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2301 ms
License file saxon-license.lic not found. R

with awk
Code:
awk '/May 26/{exit}/May 25/{f=1}f' file

# 9  
Old 05-25-2009
Tried with AWK but no luck:

awk '/May 26/{exit}/May 25/{f=1}f' catalina.out
awk: syntax error near line 1
awk: bailing out near line 1
# 10  
Old 05-25-2009
use nawk for solaris.
# 11  
Old 05-25-2009
Hurray !! Nawk worked but how to redirect that to a text file...


nawk '/May 25/{exit}/May 24/{f=1}f' catalina.out
# 12  
Old 05-25-2009
Quote:
Originally Posted by redhatperl
but how to redirect that to a text file...
redirection is part of basic shell scripting. I am not going to spoonfeed you , so you have to go read up the basics.
# 13  
Old 05-25-2009
Code:
perl -ne 'next if /^\s*$/;
          if (/^(May 25)/) {print; $in=1}
          elsif (!/^(May)/ && $in==1) {print}
          elsif (/^(May 26)/ && $in==1) {$in=0}' catalina.out

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script parse file Linux

Hi all, I need help for a script that pulls out a series of numbers from a file (attached file) Basically I need a parse to write me in a variable: 9d424312 Can someone help me? Thank you (2 Replies)
Discussion started by: gianvitolinuxs
2 Replies

2. Shell Programming and Scripting

Linux command needed

guys im new here and i need help with some linux commands. filea has keyword on each line identity aaa bbb ccc i have following commands. egrep 'www.identity' ~/home/m3 >~/home/lopo2 wc -l file ~/home/lopo2 say lopo2 has 44 lines then output saved is identity 44 (1 Reply)
Discussion started by: ahfze
1 Replies

3. Solaris

Need command to parse data

Hi Friends, I have data like below t064266 I want output into this format t064266 Data are space delimited and i want parse third column data. Thanks (9 Replies)
Discussion started by: Jagaat
9 Replies

4. UNIX for Advanced & Expert Users

Command help needed in linux flavour OS

HI, My requirement as below Log with Error Starting FeedRunner for feed: 200 Product example Items Error FeedRunner for feed: 200 Product example Items Stopping FeedRunner for feed : 200 Product example Items Feed time taken 231743 Log without Error Starting... (0 Replies)
Discussion started by: Paulwintech
0 Replies

5. Shell Programming and Scripting

Command needed in linux flavour OS

HI, My requirement as below Log with Error Code: Starting FeedRunner for feed: 200 Product example Items Error FeedRunner for feed: 200 Product example Items Stopping FeedRunner for feed : 200 Product example Items Feed time taken 231743 Log without Error Code: ... (0 Replies)
Discussion started by: Paulwintech
0 Replies

6. Solaris

Log Rotation of Catalina.out

Hi, Recently i received a request to rotate logs of catalina.out (tomcat). The file size was about 807 MB. I used logadm to truncate the log ( -c ) and zip (-z 0) it. Everything worked fine, catalina.out.0.gz was created (22 MB) and the size of original catalina.out became 0kb. After... (2 Replies)
Discussion started by: Mack1982
2 Replies

7. Shell Programming and Scripting

Parse variable into a command

What I am trying to do is write a script that makes some commands easier, now one of the commands is to rebuild mail boxes in plesk, which would would be something like /usr/loca/psa/websrvmng --vhost-reconfigure --vhost-name=domain.com but the domain.com bit is going to need to change with... (3 Replies)
Discussion started by: foz
3 Replies

8. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

9. Shell Programming and Scripting

Shell Script Needed to Parse Results

Raw Results: results|192.168.2|192.168.2.1|general/udp|10287|Security Note|For your information, here is the traceroute from 192.168.2.24 to 192.168.2.1 : \n192.168.2.24\n192.168.2.1\n\n results|192.168.2|192.168.2.1|ssh (22/tcp)|22964|Security Note|An SSH server is running on this port.\n... (2 Replies)
Discussion started by: jroberson
2 Replies

10. Solaris

Catalina Analysis

How can I make analysis for catalina.out (2 Replies)
Discussion started by: Burhan
2 Replies
Login or Register to Ask a Question