Visit Our UNIX and Linux User Community


Perl scripting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Perl scripting
# 1  
Old 05-06-2002
Perl scripting

Can anyone help .....
I am prettey new to perl but would like to do the following :- write a script that would open one or more log files and select a few lines from each and create a new file with the selected lines from the logs.
Thanx
# 2  
Old 05-07-2002
edited post

[Snipped by LivinFree]
Crawler - that was innapropriate.

It was counter-productive and a waste of time.

"A little knowledge is a scary thing"

Last edited by LivinFree; 05-11-2002 at 01:45 AM..
# 3  
Old 05-09-2002
Okay, what have you got so far? Let's see some code?

Being new to Perl does not get free scripts for you. People know how to do that because they learned Perl.

Here's a hint though:
Code:
prompt$ perldoc -f open

or
Code:
prompt$ perldoc FileHandle

# 4  
Old 05-10-2002
Re: kiddie...

Quote:
Originally posted by crawler
Serious... take a look at your question again. What you're really asking is for someone to script something for you. That, buddy, is LAME. So my suggestion is... goto the library, borrow a book called "Learning Perl" by Randal L. Schwartz and Tom Christiansen (ISBN 1-5692-284-0) and <b>Learn</b> it. Then, you can script the program that you wanted yourself.

#!usr/bin/perl
while (<>){
print "...japh...";
}
ur calling him lame? what's up with the <b> , </b>? Smilie just kidding! no offence, i just like to deflate bubles. you don't have to do the script for him, just give examples! think of it as a compliment that he seeks out your vast wisdom!
boris888
# 5  
Old 05-20-2002
Power Perl Script - Reading log files

Basically you will need to load the log file entirely into an array, or line by line because you are looking to separate items. The file system of perl in not very efficient, but nonetheless, what you ask for is VERY easy, VERY common and VERY obvious in the books, texts and examples. If you get stuck, let me know, happy to TEACH but not DO IT FOR YOU......

Depending on your OS, you may NOT be able to follow some of the former advice, or, it may be to your advantage, again, this depends on your os, not perl..... i.e. OSX, AIX, UNIX5,WIN2K,Linux,DOS, and also how your server is set up, is this under an Apache or IIS server or all by it's lonesome...

Nytok
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #622
Difficulty: Medium
In Python, you cannot have an else clause for the while loop.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Scripting

I have create this shell script #!/bin/sh if ; then echo "Usage: ./script <filename>" exit 1 elif ; then fname="$1" fi output="output.txt" i=0 ... (11 Replies)
Discussion started by: Evelin90
11 Replies

2. Shell Programming and Scripting

need help in PERL Scripting

I am having file xyz.log Its content is like this int main() { d; #ifdef e; f; #else g; #ifdef h. #else i; (2 Replies)
Discussion started by: naaj_ila
2 Replies

3. 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

4. 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

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. UNIX for Dummies Questions & Answers

Need help configuring Active Perl on Windows Vista.: Perl Scripting on Windows

Hi All, Need help configuring Active Perl on Windows Vista. I am trying to install Active Perl on Windows Vista. The version of Active Perl i am trying to install is : ActivePerl 5.10.1 Build 1006 After installing it through cmd, When i try to run perl -v to check the version, i get the... (2 Replies)
Discussion started by: Vabiosis
2 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

Need help in perl scripting.

Hi, To run a perl script i am giving command like this in DOS prompt d:> perl D:\<dir_name>\<dir_name>\sample.pl Its throwing the following error while running the above syntax error at <eval 4> line 1, near "use D:" Can anyone help? (3 Replies)
Discussion started by: mvictorvijayan
3 Replies

9. Shell Programming and Scripting

perl scripting

Hi does anyone know how to ouput "I love scripting" to "scripting love I" without using reverse() function in perl? Thanks (2 Replies)
Discussion started by: ccp
2 Replies

10. UNIX for Advanced & Expert Users

Perl scripting

hi Can any one suggest me book for perl scripting on UNIX Platform. Regards (2 Replies)
Discussion started by: rochitsharma
2 Replies

Featured Tech Videos