Should I use PERL or Shell scripting?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Should I use PERL or Shell scripting?
# 1  
Old 11-11-2008
Should I use PERL or Shell scripting?

Hello,

I have done some BASIC shell scripting/PERL scripting before so I am familiar with the languages. I am not really sure which one would lend itself better to the application I have to write.

I am required to scan the message logs for possible break in attempts. If I use shell scripting I could use GREP for a particular pattern and I am sure PERL has some similar pattern scanning capability. I am not sure which language could accomplish the following more easily: In each warning attempt I would have to locate the username used to loggin and keep track of how often this username attempted a loggon in a variable.

Opinions/suggestions?
# 2  
Old 11-11-2008
Hammer & Screwdriver

I would think a grep to an awk script. The awk script would accumulate the needed information in one or more arrays. When done reading the log file, you would then process/print any data accumulated in the awk arrays.
# 3  
Old 11-11-2008
Quote:
Originally Posted by joeyg
I would think a grep to an awk script. The awk script would accumulate the needed information in one or more arrays. When done reading the log file, you would then process/print any data accumulated in the awk arrays.

I am a little new to UNIX programming so I would like to run by you what I plan to do. I would grep for the patterns I need, store it to the a temp file and then, run awk on the temp file to process its contents.....that seems the most straightforward method to me.

One question: If the grep results in no result, how can I tell the script to simply exit? In C++ we could do something like if ![grep pattern] then...how would we go about doing this in shell scripting?

Last edited by mojoman; 11-11-2008 at 05:11 PM..
# 4  
Old 11-13-2008
I would look into using an out of the box, open source tool to get what you need done. The online docs leave a lot to be desired, but OSSEC is a really powerful tool for log parsing (Welcome to the Home of OSSEC), and it's free.

No need to reinvent the wheel.

And for what you're doing, it's not enough just to grep through a log. You need to keep track of what you already processed so you're not spamming the same alert every time your script runs.

Security ecompasses so much more than poking through a log.

Good luck.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

3. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

4. Shell Programming and Scripting

Conversion from Perl to Shell scripting

Hai ! I am doing a research on Bioinformatics and a part of the code in perl have to be converted to shell scripting. I am new to shell programming. Pls. kindly help me to convert this code to shell script though it is somewhat lengthy. PLS KINDLY HELP ME. THANKS IN ADVANCE. my @FreeEnergy =... (1 Reply)
Discussion started by: kswapnadevi
1 Replies

5. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

6. Shell Programming and Scripting

Linux/Unix shell scripting vs Perl

Hi, I have general question: i have good working Perl script with .pl extension, and now I have to migrate all to another Linux box, and I was told that I can use only shell scripting, so I'm not sure how different those two things are, will it work without any changes . Is there anything smart I... (6 Replies)
Discussion started by: trento17
6 Replies

7. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

8. Shell Programming and Scripting

Comparison of two files which contains strings using Shell scripting or PERL

Hi, I need sample code to compare the two files line by line which contains text strings and to print the difference in the third file. Thanks in advance (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

9. Shell Programming and Scripting

Comp-3 conversion possible with Shell Scripting or PERL?

I guess the subject asks it all, but I am wondering (before I go and code a COBOL module) if conversion of regular ASCII data to COMP-3 is possible on a UNIX environment (AIX 5.1)? Any help would be appreciated! Thanks, Dave (13 Replies)
Discussion started by: dfran1972
13 Replies

10. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
Login or Register to Ask a Question