RE: heredoc issure

2007-07-19 Thread christopher . l . hood








I think that Rob was onto something, here
is my 2 cents.



The print line should be like this:



print EOF



and not 



print  EOF



like you have. I think maybe that what is
happening is that the error that is being printed is saying that it cannot find
spaceEOF before end of file. Put the space between the word print,
and remove the spaces between the  and EOF, then ensure you dont have
a space or a tab or control characters before or after the EOF and it should
work.



Let me know if this helps.





Chris Hood 
RHCE (RedHat
Certified Engineer) 
C |EH
(Certified Ethical Hacker)
Linux Systems
Administrator 
An advantage to the
release early and often paradigm is that bugs can be discovered
faster. The disadvantage is that you may cause things to go down... sometimes
in a very, very bad way.











From:
lnatz [EMAIL PROTECTED] [mailto:lnatz
[EMAIL PROTECTED]] 
Sent: Wednesday, July 18, 2007
10:27 AM
To: beginners@perl.org
Subject: heredoc issure





Hi, I'm having an issue
with here docs, and I'm sure it's something 
simple that I'm overlooking but it's annoying me. Here is a snippet 
from my script. 

sub usageAndDie { 
print  EOF;

 The following single-character otions are accepted: 
 wih arguments: -T -S 
 without arguments(boolean): -g -e 
 Use: 
 -T followed by a target 
 -S followed by a source 
 -g to generate a runbook 
 -e to execute the runbook 
 Requirements: 
 you must specify a target and a source 
 you must specify either to generate a runbook, execute the 
runbook or both 

 Example: perl exec_rnbk.pl -T UT -S testing -g 
EOF 
exit 0; 
} 

Its failing with the error: Can't find string terminator EOF 
anywhere before EOF at exec_rnbk.pl line 94. 
Line 94 is print  EOF;.

Am I just missing something obvious here? 

Thanks in advance! 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ 








-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Using Config files and variables.

2005-07-31 Thread christopher . l . hood
Ok , all file contents and code are below, this is a sort of complicated
issue. I have a config file with customer static information , a couple of
modules, and a script. The basis of the problem is that in the config file
there is an sql query that has some variables in it. The script calls one
module to get the information , then another to use the information. The
problem is that the variables in the config are not being translated into
there actual values before they get used.

 

Any fresh ideas would be greatly appreciated. If more information is
needed please contact me directly and I will provide what I can.

 

*Script Here*

use strict;

unshift (@INC, /home/aup/scripts/development/modules/);

 

use DSLLookup;

 

my @customerResults = DSLLookup::GetCustomer('vzd');

my $oraResults =
DSLLookup::GetInfo(@customerResults,'192.168.102.112','TARJ 3-PTO 2');

 

* End Script *

 

 

 

* Start DSLLookup Module *

 

use DBI;

use Config::IniFiles;

 

# Declare global variables.

our $DB;

our $HOST;

our $TABLE;

our $SID;

our $count;

our $row;

our $total;

our $username;

our $password;

our $ORAPORT;

our $customer;

our $QUERY;

 

 

sub GetCustomer {

 

my($customer) = @_;

 

my $cfg = new Config::IniFiles( -file =
/home/aup/scripts/development/configs/$customer/customer.cfg);

 

$HOST = $cfg-val('AUP', 'host');

$DB = $cfg-val('AUP', 'db');

$SID = $cfg-val('AUP', 'sid');

$username = $cfg-val('AUP', 'username');

$password = $cfg-val('AUP', 'password');

$ORAPORT = $cfg-val('AUP', 'oraport');

$QUERY = $cfg-val('AUP', 'query');

 

return ($customer,$HOST,$DB,$SID,$username,$password,$ORAPORT,$QUERY);

 

} # End GetCustomer

 

sub GetInfo {

 

# pre declare some global variables. #

 

my
($affiliate,$HOST,$DB,$SID,$username,$password,$ORAPORT,$QUERY,$ip_address
,$dslam) = @_;

 

# Connect to the database.

my $dbh =
DBI-connect(DBI:Oracle:database=$DB;host=$HOST;sid=$SID;port=$ORAPORT,
$username,$password, {'RaiseError' = 1});

 

# Now retrieve data from the table.

my $sth = $dbh-prepare(qq{$QUERY});

 

#print DEBUG: $QUERY\n;

 

$sth-execute;

 

while ( my @row = $sth-fetchrow_array) {

 $ip_address = $row[0]\n;

 my $node_address = $row[1]\n;

 my $last_nm = $row[2]\n;

 my $first_name;

 if(!$row[3]){

$first_name = \n;

 }else{

 $first_name = $row[3]\n;

 }

 my $related_pon = $row[4]\n;

 my $addr_lin1 = $row[5]\n;

 print IP: $ip_address DSLAM: $node_address Last Name: $last_nm
First Name: $first_name Phone: $related_pon Address: $addr_lin1;

}

 

 

} ## End GetInfo

 

 End DSLLookup Module *

 

 

 

 

 Customer Config File Start *

[AUP]

host=192.168.2.39

db=mydb

sid=mydb_prod

username=myname

password=mypass

oraport=1525

query= END

SELECT N.IP_ADDRESS,

 P.NODE_ADDRESS,

 SO.LAST_NM,

 SO.FIRST_NAME,

 SR.RELATED_PON,

 AD.ADDR_LN1

FROM NETWORK_NODE N,

 EQUIPMENT E,

 MOUNTING_POSITION MP,

 PORT_ADDRESS P,

 SERVICE_REQUEST_CIRCUIT S,

 SERV_ORD SO,

 SERV_REQ  SR,

 EQUIPMENT E1,

 CUST_ACCt_ADDR CAA,

 ADDRESS AD

WHERE N.NETWORK_NODE_ID   = E.NETWORK_NODE_ID

 AND   E.EQUIPMENT_ID   = MP.EQUIPMENT_ID

 AND   E1.EQUIPMENT_ID   = MP.EQUIPMENT_ID_2

 AND   E1.EQUIPMENT_ID   = P.EQUIPMENT_ID

 AND   P.CIRCUIT_DESIGN_ID = S.CIRCUIT_DESIGN_ID

 AND   SO.DOCUMENT_NUMBER  = S.DOCUMENT_NUMBER

 AND   SR.DOCUMENT_NUMBER  = S.DOCUMENT_NUMBER

 AND   SR.CUST_ACCT_ID  = CAA.CUST_ACCT_ID

 AND   CAA.ADDRESS_ID   = AD.ADDRESS_ID 

 AND   P.NODE_ADDRESS  = $dslam

 AND   N.IP_ADDRESS= $ip_address

END

 

* Customer Config File End **

 

 

Chris Hood 

Investigator Verizon Global Security Operations Center 



perldoc formatting

2005-07-10 Thread christopher . l . hood
Ok basically I have written a module, and it works, I have updated the 
documentation in the module, and it works for the most part. What I am seeing 
is that when I use a single quote that the line looks like this when you use 
perldoc.

 

ookup::GetInfo(’$affiliate’,’$ip_address’,’$dslam’,’$query’);

 

I have tried changing the terminal type. I have tried changing the font. I have 
tried changing the default character set, and nothing seems to make it where I 
can use the single quotes. I also seem to be having an issue with using  or  
around an email address, they show up as lt and gt . 

 

I CAN use double quotes, however I would like to know why this is happening.

 

Chris Hood 



DBD::Oracle issue

2005-06-01 Thread christopher . l . hood
ALL,

 

Can someone help out with this error:

 

DBD::Oracle::st execute failed: ORA-03106: fatal two-task communication
protocol error (DBD ERROR: error possibly near * indicator at char 23 in
'select table_name from *all_tables') [for Statement select table_name
from all_tables] at ./oracleTest.pl line 66.

 

I have tried to set TWO_TASK environment variable to no avail.

 

The oracle connection is a remote connection made.

I have successfully looked up other information in the database with this
script.

The actual SQL command being run is select table_name from all_tables.

 

If anyone needs the actual script that is being run please mail me. But I
believe this error is specific to the select statement being run because
other selects work just fine.

 

ANY ideas / suggestions would be greatly appreciated,

 

Chris Hood

 



RE: DBD::Oracle issue

2005-06-01 Thread christopher . l . hood
Well I sent this message to both the mysql mailing list and this perl
list, because I am using perl to accomplish this, and mysql to talk to.

But anyway, thank you very much your number 3 EXACTLY fixed my issues, so
the person with the right answer contacted me. 

Again, thank you very much for your assistance.

Chris Hood 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 01, 2005 8:02 AM
To: Christopher L. Hood
Cc: mysql@lists.mysql.com; beginners@perl.org
Subject: Re: DBD::Oracle issue

Hi,
I'll try even if this is not a neither oracle nor perl-dbd list.

1. verify that NLS_LANG is correct in your client env (and all the other
ORA
vars)
2. verify the query is simply quoted ( needs \_ for _)
3. Put all oracle variables in BEGIN {ORACLe_HOME=}; in the perl script
4. verify that select * from dual is OK

Mathias



Selon [EMAIL PROTECTED]:

 ALL,



 Can someone help out with this error:



 DBD::Oracle::st execute failed: ORA-03106: fatal two-task communication
 protocol error (DBD ERROR: error possibly near * indicator at char 23
in
 'select table_name from *all_tables') [for Statement select
table_name
 from all_tables] at ./oracleTest.pl line 66.



 I have tried to set TWO_TASK environment variable to no avail.



 The oracle connection is a remote connection made.

 I have successfully looked up other information in the database with
this
 script.

 The actual SQL command being run is select table_name from all_tables.



 If anyone needs the actual script that is being run please mail me. But
I
 believe this error is specific to the select statement being run because
 other selects work just fine.



 ANY ideas / suggestions would be greatly appreciated,



 Chris Hood









--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




DBD::Oracle problems

2005-05-31 Thread christopher . l . hood
All,

 

I am getting the following error while trying to use DBD::Oracle:

 

DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD
ERROR: OCIStmtExecute) [for Statement describe ALL_USERS] at
./oracleTest.pl line 69.

 

I have tested the connection manually with sqlplus, and all is good there.
I have also run some select statements with the DBD::Oracle driver that
DID work. So all is good there. 

 

HOWEVER what is wrong with this describe statement and why do I get the
error above???

 

my $sth = $dbh-prepare(qq{describe ALL_USERS});

$sth-execute;

 

 

A WORKING snippet is:

my $sth = $dbh-prepare(qq{select count(USERNAME) from ALL_USERS});

 

and happens to return 635 as the result as expected.

 

So I believe that I understand how to use the driver but there is
obviously something about the describe that is different.

 

Thanks

Chris Hood



RE: :Oracle problems

2005-05-31 Thread christopher . l . hood
Ok that makes more sense, I will look online for a reference of oracle SQL
language, that is NOT sql*plus.

Do you know where I might start, besides google.com, of course I will do
that.

Chris

-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 31, 2005 2:55 PM
To: Christopher L. Hood; beginners@perl.org
Subject: RE: :Oracle problems

[EMAIL PROTECTED] wrote:
 All,
 
 I am getting the following error while trying to use DBD::Oracle:
 
 DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD
 ERROR: OCIStmtExecute) [for Statement describe ALL_USERS] at
 ./oracleTest.pl line 69.

DESCRIBE is a SQL*Plus command. It is not part of the Oracle SQL language.
You need to either query the data dictionary views directly, or use the
statement handle attributes like NAME, PRECISION, TYPE, etc. to get this
information.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Compare to multiple numbers

2005-05-16 Thread christopher . l . hood
Why doesn't this work to check the STDIN until it is one of the numbers
1 2 3 4 5 ?? I have tried multiple variations of this with different
brackets ie. [ ] , and ( ) .

 

until($type_number == 1 .. 5 ){ 

print Enter the number that corresponds to the type of offense you would
like a report for\n;

print 1. Virus\n2.Spam\n3.Hacking\n4.Copyright\n5.Child Pornography\n;

chomp($type_number = STDIN);

}

 

 

Chris Hood 

 



substituting variables in external file.

2005-05-11 Thread christopher . l . hood
I have a need to have 3 different templates of email text outside of my
actual script, what I want to know is can I use variables in the templates
then open the file for reading and substitute the variables in the text
with some data saved in matching variables in my script?

Is there a module that would help with this? If someone can get me
generally started I usually can continue on my own.

I haven’t written any code for this function as of yet, but I will post
some when I do.

Chris Hood 
Investigator Verizon Global Security Operations Center 
Email:[EMAIL PROTECTED] 
Desk: 972.399.5900
Verizon Proprietary



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




rows returned and while statement

2005-04-26 Thread christopher . l . hood
Ok I have an issue where I run an sql query against a database, and want
to evaluate whether or not an entry occurs for a given user, if NOT then
this run will be the first entry. Ok the problem occurs in the while
statement, everything works as expected if the user already has an entry
in the DB, however if there is NOT an entry then the while loop is skipped
completely.

 

Here is the initial code used.

 

while(my @row = $sth-fetchrow_array) {

 

if($row[4] == ) {

$first_grace_count = $row[9];

FirstOffense;

}elsif($row[12] == ) {

$second_grace_count = $row[17];

SecondOffense;

}elsif($row[20] == ) {

$third_grace_count = $row[25];

ThirdOffense;

}else {

print Offender already has 3 or more offenses and should
already be terminated\n;

}

 

 

The sub FirstOffense gathers data and inserts it into the database as the
first entry. 

 

So how can I get the FirstOffense sub to run if no rows are returned from
the initial query?

 

Chris Hood 

Investigator Verizon Global Security Operations Center 

Email:  mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED] 

Desk: 972.399.5900

Verizon Proprietary



NOTICE - This message and any attached files may contain information that
is confidential and/or subject of legal privilege intended only for the
use by the intended recipient.  If you are not the intended recipient or
the person responsible for delivering the message to the intended
recipient, be advised that you have received this message in error and
that any dissemination, copying or use of this message or attachment is
strictly forbidden, as is the disclosure of the information therein.  If
you have received this message in error please notify the sender
immediately and delete the message.

 



Reading multi line input from user

2005-04-25 Thread christopher . l . hood
I wish to read input from a user that has multiple lines with carriage
returns from stdin but not actually stop reading until a single # on a
line by itself. Is there a module / package / function that will aid in
this? I would like to do something like below:

 

Until(STDIN = #) {

$incoming_lines = STDIN;

}

$storage_var = $incoming_lines;

 

 

This is most like NOT working code, it is a logic example so that you
might understand what I am trying to accomplish, so please no comments on
the actual code shown.

 

Chris Hood 



RE: Find a specific record based on time

2005-04-20 Thread christopher . l . hood
;
my $stop_time;
my $start_time_secs;
my $session_time;
my $rsltdslam;
my $rsltport;
my @rsltDSLinfo;
my $dbh = DBI-connect('dbi:mysql:database_name','user','password') or
die(Cannot Connect: $DBI::errstr);
 
### Start 6 way union ###
my $sql = qq(
(
Select ALL VZD_DIALUP.Id, VZD_DIALUP.Date, VZD_DIALUP.Record_Time,
VZD_DIALUP.User_Name, VZD_DIALUP.Framed_IP_Address,
VZD_DIALUP.Acct_Session_Time, VZD_DIALUP.Acct_Session_Id
from VZD_DIALUP
Where VZD_DIALUP.Framed_IP_Address = '$ip'
AND VZD_DIALUP.Date = '$offdate'
)
UNION
(
Select ALL VZD_DIALUP.Id, VZD_DIALUP.Date, VZD_DIALUP.Record_Time,
VZD_DIALUP.User_Name, VZD_DIALUP.Framed_IP_Address,
VZD_DIALUP.Acct_Session_Time, VZD_DIALUP.Acct_Session_Id
from VZD_DIALUP
Where VZD_DIALUP.Framed_IP_Address = '$ip'
AND VZD_DIALUP.Date = '$prevday'
)
UNION
(
Select ALL VZD_DIALUP.Id, VZD_DIALUP.Date, VZD_DIALUP.Record_Time,
VZD_DIALUP.User_Name, VZD_DIALUP.Framed_IP_Address,
VZD_DIALUP.Acct_Session_Time, VZD_DIALUP.Acct_Session_Id
from VZD_DIALUP
Where VZD_DIALUP.Framed_IP_Address = '$ip'
AND VZD_DIALUP.Date = '$nextday'
)
UNION
(
Select ALL VZD_DSL.Id, VZD_DSL.Date, VZD_DSL.Record_Time,
VZD_DSL.User_Name, VZD_DSL.Framed_IP_Address, VZD_DSL.Acct_Session_Time,
VZD_DSL.Acct_Session_Id
from VZD_DSL
Where VZD_DSL.Framed_IP_Address = '$ip'
and VZD_DSL.Date = '$offdate'
)
UNION
(
Select ALL VZD_DSL.Id, VZD_DSL.Date, VZD_DSL.Record_Time,
VZD_DSL.User_Name, VZD_DSL.Framed_IP_Address, VZD_DSL.Acct_Session_Time,
VZD_DSL.Acct_Session_Id
from VZD_DSL
Where VZD_DSL.Framed_IP_Address = '$ip'
and VZD_DSL.Date = '$prevday'
)
UNION
(
Select ALL VZD_DSL.Id, VZD_DSL.Date, VZD_DSL.Record_Time,
VZD_DSL.User_Name, VZD_DSL.Framed_IP_Address, VZD_DSL.Acct_Session_Time,
VZD_DSL.Acct_Session_Id
from VZD_DSL
Where VZD_DSL.Framed_IP_Address = '$ip'
and VZD_DSL.Date = '$nextday'
)
ORDER BY  User_Name, Record_Time;
);
 
### End 6 way union ###
 
#pass sql query to database handle...
$sth = $dbh-prepare($sql);
 
#execute the query...
$sth-execute();
 
format VZD_TOP =
Id| Start Time | Stop Time |   Full Name
|   IP address  |   DSLAM  |  PORT
.
 
 
while(@row = $sth-fetchrow_array) {
$rsltid = $row[0];
$rsltdate = $row[1];
$rsltrecord_time = $row[2];
$rsltuser_name = $row[3];
s/^\s+//, s/\s+$// for $rsltuser_name;
$rsltframed_ip_address = $row[4];
$session_time = $row[5];
if($row[6] =~ /\//){
@rsltDSLinfo = split(/\//, $row[6]);
$rsltdslam = $rsltDSLinfo[0];
$rsltport = $rsltDSLinfo[2];
}else{
$rsltdslam = ;
$rsltport = ;
}
$start_time = DateCalc($rsltdate $rsltrecord_time,-
$session_time seconds,\$err);
my @format = %Y-%m-%d %H:%M:%S;
$start_time = UnixDate($start_time, @format);
 
 
 
format VZDOUT =
@ @ @ @
@ @ @ @
$rsltid, $start_time,   $rsltdate $rsltrecord_time, $rsltuser_name,
$rsltframed_ip_address, $rsltdslam, $rsltport
.
 
$^ = VZD_TOP;
$~ = VZDOUT;
 
write;
 }
 
}

Chris Hood 


-Original Message-
From: Jay Savage [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 19, 2005 10:57 AM
To: Christopher L. Hood; beginners perl
Subject: Re: Find a specific record based on time

On 4/19/05, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Ok, basically I have a list of start times, stop times, usernames, and
 ip's in a database, I currently have code in place that will take in a
 date and ip address and return a list of people that had that IP
address,
 with the time that they acquired the ip and the time that they released
 the ip.
 
 What I need to do is input a date  time and find out the exact user
that
 had the ip address at that time.
 
 So I have tried Date::Manip and it does most of the work for me for my
 other calculations  but it doesn't seem to give me a way to find out
what
 I need.
 
 Any ideas, or point to a better module to use would be great.
 
 Chris Hood
 

Well, what does your current code to do this look like, and where is
it going wrong for you?

--jay

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Find a specific record based on time

2005-04-19 Thread christopher . l . hood
Ok, basically I have a list of start times, stop times, usernames, and
ip's in a database, I currently have code in place that will take in a
date and ip address and return a list of people that had that IP address,
with the time that they acquired the ip and the time that they released
the ip.

What I need to do is input a date  time and find out the exact user that
had the ip address at that time.

So I have tried Date::Manip and it does most of the work for me for my
other calculations  but it doesn't seem to give me a way to find out what
I need.

Any ideas, or point to a better module to use would be great.

Chris Hood 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




DBI object version 1.32 does not match $DBI::VERSION 1.48

2005-04-06 Thread christopher . l . hood
I believe that I may have asked this question before and cannot find the
answer that I had gotten, So I will ask again.

 

I have upgraded DBI to version 1.48 and I am now having issues and errors
with my scripts. The error that I am getting is :

 

DBI object version 1.32 does not match $DBI::VERSION 1.48 at
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 249.

BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/DBI.pm line 254.

Compilation failed in require at /home/aup/scripts/cron/add_prtc_logs.pl
line 4.

BEGIN failed--compilation aborted at
/home/aup/scripts/cron/add_prtc_logs.pl line 4.

 

What is the best way to correct this issue?

 

 

Chris Hood 

Investigator Verizon Global Security Operations Center 

Email:  mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED] 

Desk: 972.399.5900

Verizon Proprietary



NOTICE - This message and any attached files may contain information that
is confidential and/or subject of legal privilege intended only for the
use by the intended recipient.  If you are not the intended recipient or
the person responsible for delivering the message to the intended
recipient, be advised that you have received this message in error and
that any dissemination, copying or use of this message or attachment is
strictly forbidden, as is the disclosure of the information therein.  If
you have received this message in error please notify the sender
immediately and delete the message.

 



RE: DBI object version 1.32 does not match $DBI::VERSION 1.48

2005-04-06 Thread christopher . l . hood
I did the install via CPAN, and I found that I DID have 2 versions
installed. I also found that the permissions that the modules and
subsequent directories had were not allowing anyone but ROOT to see the
modules.

So after renaming the old DBI.pm files to .old and changing the
permissions so that my non-root user could see the module, everything
worked fine.

The 2 questions that this brings  up is :
1. Why does CPAN only make the module directories accessible only by root
? (permissions set to 700 )
2. Why doesn't CPAN overwrite or remove the older version of DBI when the
new version is installed?

Chris Hood 


-Original Message-
From: Chris Devers [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 06, 2005 8:42 AM
To: Christopher L. Hood
Cc: Perl Beginners List
Subject: Re: DBI object version 1.32 does not match $DBI::VERSION 1.48

On Wed, 6 Apr 2005 [EMAIL PROTECTED] wrote:

 I have upgraded DBI to version 1.48 and I am now having issues and 
 errors with my scripts. The error that I am getting is :

How did you do the upgrade?

It looks like you have remnants of the old version still installed.
 


-- 
Chris Devers



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: DBI object version 1.32 does not match $DBI::VERSION 1.48

2005-04-06 Thread christopher . l . hood
Ok , I thought I had it fixed, but it is still causing problems, what is
the BEST way to solve this, what is the BEST way to remove all the old
versions and ensure that the latest (1.48) is installed?

Chris Hood 


-Original Message-
From: Chris Devers [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 06, 2005 8:42 AM
To: Christopher L. Hood
Cc: Perl Beginners List
Subject: Re: DBI object version 1.32 does not match $DBI::VERSION 1.48

On Wed, 6 Apr 2005 [EMAIL PROTECTED] wrote:

 I have upgraded DBI to version 1.48 and I am now having issues and 
 errors with my scripts. The error that I am getting is :

How did you do the upgrade?

It looks like you have remnants of the old version still installed.
 


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




DBD::Oracle installation Woes

2004-09-21 Thread christopher . l . hood
Ok here is the deal, our admin is trying to install DBD::Oracle for me to
access one of our affiliates databases. The oracle instant basic client
and sqlplus has been installed as well as GetOpt::Long.

The installations all went well except for DBD::Oracle, it fails to
install, I am pretty sure because Oracle is NOT installed on this machine,
and will NOT be installed on this machine.

S here is the actual situation, we cannot NFS mount the remote DB
server in order to use that path as ORACLE_HOME, We cannot install Oracle
on our machine, is there a way to get DBD::Oracle built and installed on
my machine, without the Oracle files locally?

OH, btw, I cannot FTP the files from the DB server to my machine either,
this is a case of a partner company at an international location, with
limited (very limited) access to the actual DB server, which is why I am
scripting the queries from my machine and just getting the data I need
from them.

Oh and P.S. my machine is Red Hat Enterprise Linux ES release 3 (Taroon
Update 3) 2.4.21-15.0.4.EL  .



Chris Hood 
Investigator Verizon Global Security Operations Center 
Email:[EMAIL PROTECTED] 
Desk: 972.399.5900
Verizon Proprietary




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: delete all lines in a file save it come out

2004-08-31 Thread christopher . l . hood


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 31, 2004 6:50 AM
To: [EMAIL PROTECTED]
Subject: delete all lines in a file save it come out

Hi ,
I have a problem in deleting all the lines in a file and saving it .
Actually my log file keep appending all the messages for that i need to
clean it up i.e delete all lines in it save it . when i do this
initially
file shows zero bytes , but as soon as the next message appends ,, file
sizes jumps to the actual size and not from zero . I tried this with
flock() option also . for Somereasons it is not working I could see some
junk characters like this in the file

[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^  Because of these characters, file size will not
go to zero bytes.
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^

here is my script... Can somebody help on this ..

for my $logfile (@filelist) {
$lines = 0;
open(FILE,  $logfile) or die Couldn't open $logfile : $!\n;
# This logfile keeps appending in a linux m/c
flock(FILE,2);
while (sysread FILE, $buffer, 4096) {
   $lines += ($buffer =~ tr/\n//);
}
   print FILE Sudhakar;
flock(FILE,8);
close(FILE);
print No. of lines in $logfile, $lines, \n;
# system vi $logfile +delete$lines +wq; # Delete all the lines
in the file  ...  This command will never work for me. Dont know
}


Sudhakar Gajjala


Well if all you want to do is count the number of lines in the file then
zero out the file, the easiest way that I can think of would be to use a
couple of system calls like this.

$logfile = myfile.txt;

$numlines = system(`cat $logfile |wc -l`)|| die Cannot get number of
lines\n;

print $numlines;

system(`cp /dev/null $logfile`) || die Cannot zero load file\n;

Of course since you seem to have a list of files you will have to modify
this, but the general idea is there.

And of course this script is dependent on your machine being a unix box,
which you didn't mention what kind of OS you were running.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: How do i run shell command

2004-08-31 Thread christopher . l . hood



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 31, 2004 12:10 AM
To: [EMAIL PROTECTED]
Subject: Re: How do i run shell command


It works for me . Thanks

Sudhakar Gajjala





Chris Devers [EMAIL PROTECTED] on 08/30/2004 10:47:55 PM

Please respond to [EMAIL PROTECTED]

To:Sudhakar Gajjala/C/[EMAIL PROTECTED]
cc:[EMAIL PROTECTED]
Subject:Re: How do i run shell command


On Mon, 30 Aug 2004 [EMAIL PROTECTED] wrote:

 I was trying to run System command from my perl Script . As i have
pipe
( |
 Anybody help me how to run shell command in Perl

 Here is the command :  system cat $filename | wc -l;

You realize, of course, that this can be done entirely in Perl ?

Quoting from the excellent _Perl Cookbook_:

 [...] you can emulate wc by opening up and reading the file
yourself:

 open(FILE,  $file) or die can't open $file: $!;
 $count++ while FILE;
 # $count now holds the number of lines read

 Another way of writing this is:

 open(FILE,  $file) or die can't open $file: $!;
 for ($count=0; FILE; $count++) { }

 If you're not reading from any other files, you don't need the
$count
 variable in this case. The special variable $. holds the number of
 lines read since a filehandle was last explicitly closed:

 1 while FILE;
 $count = $.;

 This reads all the records in the file and discards them.

But if you really do need to do this via a system command -- you don't,
but I'll play along -- then the command as you've given it is what is
known as a Useless Use Of Cat.

This command --

 cat file | wc -l

-- is equivalent to this one --

 wc -l file

-- but the latter invokes less overhead, and so should be a bit faster.

Unless you really are conCATenating a chain of files together, most
commands of the form cat foo | cmd can be rewritten as cmd foo or,
maybe, cmd  foo.



--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/

np: 'It's Not Easy Being Green (lo-fi midi version)'
  by Kermit
  from 'The Muppet Movie Soundtrack'




Chris,

You are exactly right, that is a useless use of cat, old habits die
hard. And of course you are correct in that it can be done entirely in
perl, the availability of the shell cmd wc makes us lazy, and we don't
want to code what we can just call from the system.

Chris Hood




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




shift question

2004-08-30 Thread christopher . l . hood
OK here comes the newbie question.

I found this in a template for creating subroutines, this is the base
that is created when you use the template to create the subroutine.

So now the newbie part, why would you place my  $par1 = shift; in the
subroutine template, and what does it do??

Basically I am trying to find out if I need to modify the template or
not. Any help would be greatly appreciated.

Oh and btw I looked at the shift function and it applies to the @_
array, which is not being used in this subroutine, and neither is @par1
, so my only guess would be that the template is creating a verifiably
empty variable called $par1 .



sub Irfan
{
  my  $par1 = shift;

return ;
} # --  end of subroutine Irfan  --



Confused,
Chris Hood  



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: shift question

2004-08-30 Thread christopher . l . hood
Ok fantastic, I totally understand that, and if there were going to be
more than one thing passed, just insert $par2 = shift; on the next line
and then the second argument is in $par2, I assume.right??



Chris Hood  
Investigator Verizon Global Security Operations Center 
Email: [EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient.  If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein.  If you have received this message in error please
notify the sender immediately and delete the message. 

-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 30, 2004 2:41 PM
To: Christopher L. Hood; [EMAIL PROTECTED]
Subject: RE: shift question

[EMAIL PROTECTED] wrote:
 OK here comes the newbie question.
 
 I found this in a template for creating subroutines, this is the base
 that is created when you use the template to create the subroutine.
 
 So now the newbie part, why would you place my  $par1 = shift; in
 the subroutine template, and what does it do??
 
 Basically I am trying to find out if I need to modify the template or
 not. Any help would be greatly appreciated.
 
 Oh and btw I looked at the shift function and it applies to the @_
 array, which is not being used in this subroutine, and neither is
 @par1 , so my only guess would be that the template is creating a
 verifiably empty variable called $par1 .
 
 
 
 sub Irfan
 {
   my  $par1 = shift;
 
 return ;
 } # --  end of subroutine Irfan  --

@_ holds the actual arguments passed to the subroutine call.

So if you call the sub as:

   Irfan('foo');

Then inside the sub:

   my $par1 = shift;

will assign the first argument ('foo'), to $par1

This is a very common idiom.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: POD on new module to make sure it looks right before uploading to CPAN

2004-08-26 Thread christopher . l . hood
Ok well sorry about that I must have missed your earlier post. Good luck
on the other module, it looked simpler to me.

Chris Hood  
Investigator Verizon Global Security Operations Center 
Email: [EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient.  If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein.  If you have received this message in error please
notify the sender immediately and delete the message. 

-Original Message-
From: JupiterHost.Net [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 25, 2004 5:41 PM
To: Christopher L. Hood
Cc: [EMAIL PROTECTED]
Subject: Re: POD on new module to make sure it looks right before
uploading to CPAN



[EMAIL PROTECTED] wrote:

 Well I don't know if it is possible, however the POD::HTML module is
 very skimpy on documentation, so try this one instead.
 
 http://search.cpan.org/~sburke/Pod-Simple-3.02/lib/Pod/Simple/HTML.pm
 
 it appears to be very easy to use, however I cannot test.
 
 Just give it a try and if you have problems then mail the list, but
most
 people don't want to help someone that hasn't even tried yet.

I understand, however I did try it and posted all my code last week in
this thread and no one said a word so I figured I'd simplify my question
:)

I'll see if I can't get the Pod::Simple::HTML one to do it :)

Thanks



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




find out who was online at a given time

2004-07-20 Thread christopher . l . hood
Ok, this may or may not be a tricky one I will try and be succinct in my
statement.
 
I have a database (mysql 4.0) with radius log entries for each day, we
receive emails about Acceptable Use Abuses and must figure out exactly
who was online with a certain IP address when the abuse occurred. As you
will see below there are multiple starts and stops for any given IP
address so here is the scenario:
 
Problem: Spam Abuse
IP of offender: 66.50.xxX.245
Date of offense: 2004-07-05
Time of offense: 16:15
 
Now if I query the database based on date and ip address, I get the
following:
Id Date   Time   Record TypeFull
Name   IP Address
==        
= 
 
349 2004-07-0511:21:08  Start [EMAIL PROTECTED]
66.50.xxX.245
345 2004-07-0511:21:09  Start [EMAIL PROTECTED]
66.50.xxX.245
413 2004-07-0511:22:32  Stop  [EMAIL PROTECTED]
66.50.xxX.245
118984  2004-07-0517:22:26  Start [EMAIL PROTECTED]
66.50.xxX.245
149049  2004-07-0518:36:19  Stop  [EMAIL PROTECTED]
66.50.xxX.245
90344   2004-07-0516:09:40  Start [EMAIL PROTECTED]
66.50.xxX.245
90380   2004-07-0516:09:40  Start [EMAIL PROTECTED]
66.50.xxX.245
97630   2004-07-0516:28:20  Stop  [EMAIL PROTECTED]
66.50.xxX.245
97671   2004-07-0516:28:20  Stop  [EMAIL PROTECTED]
66.50.xxX.245
97598   2004-07-0516:28:20  Stop  [EMAIL PROTECTED]
66.50.xxX.245
149142  2004-07-0518:36:33  Start [EMAIL PROTECTED]
66.50.xxX.245
310758  2004-07-0518:36:33  Start [EMAIL PROTECTED]
66.50.xxX.245
117382  2004-07-0517:18:34  Start [EMAIL PROTECTED]
66.50.xxX.245
117437  2004-07-0517:18:34  Start [EMAIL PROTECTED]
66.50.xxX.245
117351  2004-07-0517:18:34  Start [EMAIL PROTECTED]
66.50.xxX.245
118181  2004-07-0517:20:34  Stop  [EMAIL PROTECTED]
66.50.xxX.245
807 2004-07-0511:27:55  Start [EMAIL PROTECTED]
66.50.xxX.245
805 2004-07-0511:27:56  Start [EMAIL PROTECTED]
66.50.xxX.245
158170  2004-07-0518:56:54  Start [EMAIL PROTECTED]
66.50.xxX.245
161543  2004-07-0519:04:02  Stop  [EMAIL PROTECTED]
66.50.xxX.245
110780  2004-07-0517:01:56  Start [EMAIL PROTECTED]
66.50.xxX.245
116436  2004-07-0517:16:09  Stop  [EMAIL PROTECTED]
66.50.xxX.245
 
 now of course I changed the usernames and modified the IP for  this
mailing but that doesn't matter, now, the time field in the Database IS
a time data type. What I need to be able to do is find the start before
the offense time, and the stop after the offense time so I know that the
person with the start and the stop is the one that committed the abuse.
 
I haven't actually put code to bits yet, because I am not exactly sure
how to go about creating this logic code. I don't think I can just say
if $timefield  time of offense and $timefield  time of offense; return
some stuff.
 
So any help on how to start with this would be greatly appreciated.
 
Chris Hood  
Investigator Verizon Global Security Operations Center 
Email:  mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient.  If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein.  If you have received this message in error please
notify the sender immediately and delete the message. 
 


find out who was online at a given time

2004-07-16 Thread christopher . l . hood
Ok, this may or may not be a tricky one I will try and be succinct in my
statement.
 
I have a database (mysql 4.0) with radius log entries for each day, we
receive emails about Acceptable Use Abuses and must figure out exactly
who was online with a certain IP address when the abuse occurred. As you
will see below there are multiple starts and stops for any given IP
address so here is the scenario:
 
Problem: Spam Abuse
IP of offender: 66.50.xxX.245
Date of offense: 2004-07-05
Time of offense: 16:15
 
Now if I query the database based on date and ip address, I get the
following:
Id Date   Time   Record TypeFull
Name   IP Address
==        
= 
 
349 2004-07-0511:21:08  Start [EMAIL PROTECTED]
66.50.xxX.245
345 2004-07-0511:21:09  Start [EMAIL PROTECTED]
66.50.xxX.245
413 2004-07-0511:22:32  Stop  [EMAIL PROTECTED]
66.50.xxX.245
118984  2004-07-0517:22:26  Start [EMAIL PROTECTED]
66.50.xxX.245
149049  2004-07-0518:36:19  Stop  [EMAIL PROTECTED]
66.50.xxX.245
90344   2004-07-0516:09:40  Start [EMAIL PROTECTED]
66.50.xxX.245
90380   2004-07-0516:09:40  Start [EMAIL PROTECTED]
66.50.xxX.245
97630   2004-07-0516:28:20  Stop  [EMAIL PROTECTED]
66.50.xxX.245
97671   2004-07-0516:28:20  Stop  [EMAIL PROTECTED]
66.50.xxX.245
97598   2004-07-0516:28:20  Stop  [EMAIL PROTECTED]
66.50.xxX.245
149142  2004-07-0518:36:33  Start [EMAIL PROTECTED]
66.50.xxX.245
310758  2004-07-0518:36:33  Start [EMAIL PROTECTED]
66.50.xxX.245
117382  2004-07-0517:18:34  Start [EMAIL PROTECTED]
66.50.xxX.245
117437  2004-07-0517:18:34  Start [EMAIL PROTECTED]
66.50.xxX.245
117351  2004-07-0517:18:34  Start [EMAIL PROTECTED]
66.50.xxX.245
118181  2004-07-0517:20:34  Stop  [EMAIL PROTECTED]
66.50.xxX.245
807 2004-07-0511:27:55  Start [EMAIL PROTECTED]
66.50.xxX.245
805 2004-07-0511:27:56  Start [EMAIL PROTECTED]
66.50.xxX.245
158170  2004-07-0518:56:54  Start [EMAIL PROTECTED]
66.50.xxX.245
161543  2004-07-0519:04:02  Stop  [EMAIL PROTECTED]
66.50.xxX.245
110780  2004-07-0517:01:56  Start [EMAIL PROTECTED]
66.50.xxX.245
116436  2004-07-0517:16:09  Stop  [EMAIL PROTECTED]
66.50.xxX.245
 
 now of course I changed the usernames and modified the IP for  this
mailing but that doesn't matter, now, the time field in the Database IS
a time data type. What I need to be able to do is find the start before
the offense time, and the stop after the offense time so I know that the
person with the start and the stop is the one that committed the abuse.
 
I haven't actually put code to bits yet, because I am not exactly sure
how to go about creating this logic code. I don't think I can just say
if $timefield  time of offense and $timefield  time of offense; return
some stuff.
 
So any help on how to start with this would be greatly appreciated.
 
Chris Hood  
Investigator Verizon Global Security Operations Center 
Email:  mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient.  If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein.  If you have received this message in error please
notify the sender immediately and delete the message. 
 


Global and Local variables issue

2004-07-13 Thread christopher . l . hood
Ok what I have is 3 variables assigned in the global block using my then
when I try to use those variables later in a subroutine I get an error.
The error is below:
 
Error during compilation of
/usr/local/rt3/local/html/cgi-bin/aupsearch.cgi:
Variable $ip will not stay shared at
/usr/local/rt3/local/html/cgi-bin/aupsearch.cgi line 141.
Variable $date will not stay shared at
/usr/local/rt3/local/html/cgi-bin/aupsearch.cgi line 142.
Variable $customer will not stay shared at
/usr/local/rt3/local/html/cgi-bin/aupsearch.cgi line 158.
 
 
Now it was my understanding that if I used my in the global block, that
I could reference that variable in a subroutine. OH, and strict is on,
and cannot be taken off.
 
Any help with this will be  greatly appreciated.
 
 
Actual Code below, some code omitted because of security and for
clarity.
 
.
 
# Get parameters from the html form
my $date = $q-param('date');
my $ip = $q-param('ip');
my $customer = $q-param('customer');
 
### Sub to Print VZD Table ###
sub PrintVZDTable {
my @row;
my $rsltid;
my $rsltdate;
my $rslttime;
my $rsltrecord_type;
my $rsltfullname;
my $rsltframed_ip_address;
my $tableline;
my $rsltuser_name;
my $rsltrecord_time;
my $rsltevent_timestamp;
my $sth;
 
print $ip;
print $date;
 
..
 
}
 
 
Chris Hood  
Investigator Verizon Global Security Operations Center 
Email:  mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient.  If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein.  If you have received this message in error please
notify the sender immediately and delete the message. 
 


RE: pattern matching binary or garbage characters in string

2004-07-01 Thread christopher . l . hood
Thanks to all that helped with this problem, and thanks especially to
RandyS as he hit the nail on the head. Here is the final working code
block below.

while (LOGFILE) {
chop $_ ;
if( (/JUNIPER/) || (/REDBACK/) ){
print DSL $_ . \n;
} else {
if ($_ =~ (/([^@,:[:print:]\/])/) ) {
print ERROR $_ . \n;
next;
}
print DIALUP $_ . \n;
}
}

Chris Hood  
Investigator Verizon Global Security Operations Center 
Email: [EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient.  If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein.  If you have received this message in error please
notify the sender immediately and delete the message. 




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: printing 10 scalers/elements

2004-07-01 Thread christopher . l . hood
Ok well that might be what you are looking for, but also check out
format, link below:

http://www-cgi.cs.cmu.edu/Web/People/rgs/pl-format.html

or 

perldoc perlform 

It should be an easy matter to format your output to however many
columns you want.

Chris Hood

Chris Hood  
Investigator Verizon Global Security Operations Center 
Email: [EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient.  If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein.  If you have received this message in error please
notify the sender immediately and delete the message. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 01, 2004 7:48 AM
To: [EMAIL PROTECTED]
Subject: printing 10 scalers/elements

All, 

I am trying to figure out how to print 8 scalers/elements then \n,  then
5 
more lines of 8 or less for a max total of 40  Here is my code: 

print FILEOUT eject 0,0,0 ;
my $count = `wc -l $ejectapes`;

if ($count = 40 ) {

while(FILE) {
chomp $_;
print FILEOUT $_ ;   # if 1..8
#print substr($a,0,7);
}
close (FILEOUT);

}


The substr is sort of what I want, but is sprintf possible ...what
should 
I use?  Here is what my end results will look like if I had a file with
40 
E strings:

E E E E E E E E  \n
x5 \n

anything less but  it cannot exceed 8 per line:

E E E E E E E E  \n
E . \n


thank you, 
Derek B. Smith



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




pattern matching binary or garbage characters in string

2004-06-30 Thread christopher . l . hood
I have a log file with thousands of lines, some of those lines come in with garbage / 
binary data in them. The lines with that happening are junk and of no use to me I want 
to pattern match for the junk and simply do nothing with that line, all other lines 
get divided into 2 different output files.
 
The code that I have below will separate the lines into output files but does not take 
into account the garbage.
 
# Split the lines into the appropriate files.
while (LOGFILE) {
   if ( (/JUNIPER/)||(/REDBACK/) ){
   print DSL $_ ;
   } else {
   print DIALUP $_ ;
   }
}
 
I have included one good line and one garbage line in this post, be aware though that 
outlook and other mail clients will convert the control characters in the garbage to 
single characters so the garbage lines below is not 100% accurate but you should get 
the jist.
 
 
Good line:
06/16/2004,00:11:02,CVX_GUAYNABO_OLD,Stop,[EMAIL 
PROTECTED],200,username,10.xx.x4.1,1218,2,66.x3.x4.x7,7879592525,7877901623,C4536D6E:0005319,,0,
 
 
 
Garbage line:
06/16/2004,00:11:02,ARECIBO2,Stop,Unknown,Unknown,T 
e2y8dM(Q99zq/k8a,^808185?9bcX*A83W8d2859I$ES_2A0cR+#T!k88nW8ae9393[92hed8380vC90,10.xx.x0.1,3145,7,,7879592000,7878781076,C390F9EB:00182BC,,0,
 
 
 
 
 
Chris Hood  
Investigator Verizon Global Security Operations Center 
Email:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] 
Desk: 972.399.5900

Verizon Proprietary 

NOTICE - This message and any attached files may contain information that is 
confidential and/or subject of legal privilege intended only for the use by the 
intended recipient.  If you are not the intended recipient or the person responsible 
for delivering the message to the intended recipient, be advised that you have 
received this message in error and that any dissemination, copying or use of this 
message or attachment is strictly forbidden, as is the disclosure of the information 
therein.  If you have received this message in error please notify the sender 
immediately and delete the message.