Hello,
How can I split the data in a line by a single whitespace but also keep
portions between quotes together? Here is an example of a line of data I'm
trying to parse:
id=firewall time="2003-10-30 04:15:01" fw=66.74.67.229 pri=5 c=256 m=38
msg="ICMP packet dropped" n=63211 src=1.1.1.1 dst=2.2
Hello all,
I've got a file which contains ports and hostnames. I'd like to count the
number of instances that each item occurs in my file. I'm having a
difficult time with this.
This is my script: Basically I'm splitting the first line a few times to
get the data I need. What am I doing wro
I figured it out already! I ran a replace on the dst_port and replaced it
with a whitespace which threw off the count. I've modified it to delete the
whitespace and all works perfect.
Joshua Scott
Security Systems Analyst, CISSP
626-568-7024
-Original Message-
From: Scott, J
AM
To: Scott, Joshua
Cc: [EMAIL PROTECTED]
Subject: Re: Mail::Sendmail Module
combine all the lines using \n characters and store it in the hash variable
- Original Message -
From: "Scott, Joshua" <[EMAIL PROTECTED]>
To: "Beginners Perl" <[EMAIL PROTECTED]>
S
I'd like to know the best/easiest way to sort a hash based on the values of
it's keys. Here is a snippet of my code.
%somehash=();
foreach (@somearray) {
$somehash{$_}++;
};
Basically I'm getting a count of unique items in an array and I want to sort
by the number of each item. I've
Change your open line to read as follows:
open (IN,"$file1") or die("Cannot Open: $!");
Joshua Scott
Security Systems Analyst, CISSP
626-568-7024
-Original Message-
From: Johnstone, Colin [mailto:Colin.Johnstone@;det.nsw.edu.au]
Sent: Wednesday, November 06, 2002 1:25 PM
To: 'Nikola Ja
I've created a group of Perl subroutines to handle the creation and layout
of my web pages. These subs are used when browsing to my website.
Basically all they do when invoked is print a bunch of HTML. I've now run
into the scenario where I'd like to use these same subs to print static web
pages
le
without modifying the subs code.
Joshua Scott
Security Systems Analyst, CISSP
626-568-7024
-Original Message-----
From: Scott, Joshua
Sent: Thursday, January 09, 2003 4:07 PM
To: [EMAIL PROTECTED]
Subject: Perl Subroutines
I've created a group of Perl subroutines to handle t
Wow, that was really easy! Thank you very much for your help!!
Joshua Scott
Security Systems Analyst, CISSP
626-568-7024
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 5:11 PM
To: [EMAIL PROTECTED]
Subject: Re: Perl Subroutines
Hi Jos
and voila.
Thanks to everyone who posted comments.
Joshua Scott
Security Systems Analyst, CISSP
-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 7:04 AM
To: [EMAIL PROTECTED]
Subject: RE: Perl Subroutines
From: "Scott, Joshua&quo
I've got a CSV file which I need to process. The format is as follows.
"Smith, John J",1/1/2002,1/15/2002,"Orlando, FL",Florida
"Doe, John L",1/1/2002,1/15/2002,Los Angeles, California
I've tried splitting it using: @row = split(",",$data);
The problem is with the fields that contain the comma
ginal Message-
From: Konrad Foerstner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:29 PM
To: Scott, Joshua
Cc: [EMAIL PROTECTED]
Subject: Re: Splitting a variable
On Thu, 16 Jan 2003 15:12:05 -0800
"Scott, Joshua" <[EMAIL PROTECTED]> wrote:
> I've g
Good evening,
I'm looking for advice or ideas on querying MS Active Directory. There is a
module on CPAN but it appears to only run on Windows. I was wondering if
there is any module or method to query from a Linux system. All of my other
scripts are housed on a single Linux box and I'd really
Hi everyone,
I'm starting to write a script which gathers the output of the SAR command
from Linux and does something with it. Can anyone recommend an simple way
to gather specific data and output it to some kind of graph? The SAR
command in Linux can output in a delimited format. Once I decide
This is how I've done this for my scripts:
do "/filename";
Then I just call the sub in the normal method.
-Original Message-
From: Jamie Risk [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 2:11 PM
To: [EMAIL PROTECTED]
Subject: including subroutines from other files ...
I've used the daemonize subroutine described in the PERL manpages on Unix to
completely disassociate a child process from a parent. Will this process
work under a Windows environment? If not, what is the best way to do this?
Thank you,
Joshua Scott
Security Systems Analyst, CISSP
626-568-7024
I'm very new to Perl programming so please bear with me. I'm working on a
program that will open up a certain logfile, read the contents, upload
certain content to a database and update the status to the same database.
The goal is to run this program once a week. Currently the program just
uplo
Title: Message
Hello
everyone, first I'd like to say thank you to everyone who responded to my
issue with Avoiding Duplicate Entries. I took the advice given and found a
solution. Thank you very much!
My latest problem
has to do with regular expressions and the logfile that Norton Antivi
Good evening,
I'm having a hard time figuring out how to make a portion of my script work.
Basically I'd like to split a specific field and use the names from an array
as the scalar variable names for each field. Here is a snip of my code:
# Begin Code
$data = "A Tab Separated Dat
What do I need to do in order to use a filehandle that was opened earlier in
a program within a subroutine? I've included an example of the code I have
that is not doing what I would like. Basically, I never get any output to
the file. If I change it so that it doesn't use the subroutine when wr
What is the best way to stop the processing of a subroutine if an error is
found without exiting the entire program? For example, I've got a
subroutine that reads from a file and processes each line. I know to use
the following code if I want to stop processing the program:
open(FILE,"somefile.t
Whenever I view the processes (ps -ef) running on my Linux box, my perl
scripts always show as:
"/usr/bin/perl ./scriptname.pl"
Is there any way to modify this so that it appears differently? I'd like to
be able to hide as much as possible.
Thank you,
Joshua Scott
==
It works with 5.8.0 under Red Hat 9.0, but not 5.8.0 running under Red Hat
8.0. Are there any workarounds or fixes for this?
Joshua Scott
Security Architect, CISSP
626-568-7024
-Original Message-
From: Steve Grazzini [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 7:28 PM
To:
I'm trying to copy data from one database field to another. The problem is
that the field contains various newline and other types of control
characters. Whenever the script runs, it processes those as perl code
instead of data like I'd like it to. How can I prevent it from doing this?
Here i
I'm not familiar with the DBI::quote method. I'll have to look that one up.
However, I already solved my problem. The issue was with the ',\,\n,$ and @
characters. All I did was add a backslash to the front of each of these
characters and voila...my script ran perfectly.
Thanks anyways for the
25 matches
Mail list logo