Monday, March 24, 2014

RegEx for WebLogic Admin

Trick on grep


Normally every WebLogic user/Admin knows that "ps -ef|grep java" gives you the WebLogic servers process list in any UNIX or Linux environments. Most of the forums suggesting use "|grep -v" to exclude the "grep line". But, here I don't want to use one more pipe and grep -v option really makes expensive in CPU cycles. Searched for the optimistic solutions and finally found! Two choices using --exclude  and using regex.

The exclude options is not available on all UNIX systems. So I've chosen next option.

How do you avoid the grep line in the grep command output itself?
Here the trick is using the regular expression to workout this requirement. Use your searching pattern any one of the character in [] then it will automatically excludes the grep line from the output. actually it wouldn't get output itself!

bash-2.05$ ps -ef |grep jav[a]
weblogic   950   934  0   Feb 10 ?        0:06 /usr/local/bea/jdk142_11/bin/java -client -Xms32m -Xmx200m -Xverify
:none

Note here I have tried out this trick on Sun Solaris 9 machine. Write your experiments in the comment box, share it!

No comments:

Post a Comment

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me wlatechtrainer@gmail.com
QK7QN6U9ZST6