Perlers
I need to remove any line that begins with \d+ yet end with \s*
Here is the data
_BEGIN_DATA_
0 2005/09/23 17:25 221 100% -il-o-b---U- sf F02043
1 2005/06/03 04:11 524 100% -il-o-b---U- sf F02017
2 2005/06/10 00:12 592 100% -il-o-b---U- sf F02018
3
Do you mean like
unless($_ =~ /^\s*\d+\s*$/){
print $_;
}
?
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 22, 2006 2:36 PM
To: beginners@perl.org
Subject: whitespace beginning and end
That last; statement makes certain of it. So, the second
[EMAIL PROTECTED] wrote:
:
: My problem is it mails once then it
Perlers
I have Perl program that looks for a certain string in a inode backup log
file and if the log file is = 5 minutes old it will continue on. If it
finds this string from todays date 00:01 to 00:00 on it will email a
warning.
My problem is it mails once then it will mail again about the same
Jay Savage
[EMAIL PROTECTED]
l.com
Chas Owens
[EMAIL PROTECTED]
.com
Tom Phoenix
[EMAIL PROTECTED]
om
snip
my $ftp = Net::FTP-new($remotehost, Debug = 10)
|| do {print FTPLOG \nCannot connect to $remotehost:
$!,
mailme(); return};
snip
This is a bit off topic, but I can't look at code like this without
suggesting the following alternative:
near the top of your
the || do lines in the ftp section
with a routine call to? :
my $olddie = $SIG{__DIE__};
$SIG{__DIE__} = sub {
my $error = shift;
$olddie-{$error} if ref $olddie;
mailme($error);
#other error stuff here
};
snip
No, that defines the override
All,
My problem seems to be within the Net::FTP module. I have intentionally
modified my password so that my error routines can be tested, but once the
login
piece fails it continues on, when I would expect that it should die at the
code in red. The uninitialized value is $OHMONSTER, but the
All,
I have a task to complete for a user. He wants me to rename a file on a
remote server so that he can pick it up.
I am trying to use a reg exp or a blog but this is not working. Any tricks
of the perl trade will be mucho appreciated!
The file format is OhioHealthyyymmdd[0-9].xml
The [0-9]
Ryan Frantz
[EMAIL PROTECTED]
med-llc.com
Jay Savage
[EMAIL PROTECTED]
l.com
Tom Phoenix
[EMAIL PROTECTED]
om
what is this pack actually doing compressing the data in each element
or the entire array or both?
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Gerard Robin
Perl'ers
I am using gpg within a Perl program to decrypt some data files. In order
to decrypt a passphrase has to be passed to the gpg binary and I choose to
use fileno function but it is hanging waiting on the passphrase. I am
trying to pass the passphrase to the binary via fileno.
Any ideas
JupiterHost.Net
[EMAIL PROTECTED]
st.net
I cannot figure out how Net::FTP set its local current directory for gets
of remote files? Does anyone know?
I want to get remotefile from remotehost using:
but I want to place this file in $localdir not in what Net::FTP claims to
be
get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )
Get
All,
I am using gpg ( opensource encryption/decryption tool) to send files via
ftp to a remote site.
In my WIN32 Perl program I am trying to figure how I would do this
equivalent in Unix...
# cat gpgpass |gpg - - all the options newfile encryptedfile
The gpgpass is the password that will enable
All,
Here is my script and it is outputting file is not present when it should
be outputting temp file is good and $MHfile is there\n;
Am I missing something since I am running this is a Windows env?
thank you,
derek
#!/usr/bin/perl
use strict;
use warnings;
require 5.8.0;
$ENV{PATH} =
ok I will take that out I reran it and still get the same error. This
is not the problem.
Note: this is the correct way to do it within Unix.
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
John W. Krahn
[EMAIL PROTECTED]
In my situation I have a string like so:
my $string = '20050516';
and I want to rearrange it to look like: 05162005, so I tried:
my $newstring =
substr($string,0,8).substr($string,0,4).substr($string,8,0);
But my problem is: it's leaving 2005 in the beginning of the string to look
like
Roberto
Etcheverry
[EMAIL PROTECTED]
[EMAIL PROTECTED]
h.com
Nevermind on this problem, I fixed it but will be in touch.
thx.
derek
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Derek
Chris Devers
[EMAIL PROTECTED]
m
Chris Devers
[EMAIL PROTECTED]
m
Charles K.
Clarkson
[EMAIL PROTECTED]
Charles K.
Clarkson
[EMAIL PROTECTED]
Greg Jetter
[EMAIL PROTECTED]
n.com
Derek
Smith/Staff/OhioH
ealth
Jay Savage
[EMAIL PROTECTED]
l.com
Greg Jetter
[EMAIL PROTECTED]
n.com
I have written a CGI Perl program that allows my users to view relevant
data.
The data is produced by a Unix application command and I have told it to
write to a intranet page that looks like:
|--|
| ( ) |
|--|All-Clients
|--|
| ( ) |
|--|Backup-Tapes
|--|
| ( ) |
As I am attempting to compile this module I am getting many errors on an
HPUX 11.11 64 bit machine.
Any help please ?
(See attached file: log)
thank you,
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
log
Description: Binary data
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
Charles K.
Clarkson
[EMAIL PROTECTED]
what do you mean I cant? It is logically working! Is this is
recommedation for more readibility and thats it? Or is this Perl best
practice thingy?
thank you!
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Charles K.
Clarkson
[EMAIL PROTECTED]
do you want me to seed the entire program. it is over 700 lines?
it on lines 246 for eaxmple. And anywhere I assign a variable to a
q-param construct such as $which_import and $which_radio_button.
thank you so much!
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Charles K.
Clarkson
[EMAIL PROTECTED]
All,
I am having some weird system call return codes and I am hoping for some
help.
when I run in debug mode a system command I get this error:
here is my debugger code
perl -dT foo
use strict;
use warnings;
$ENV{PATH} = qq (/blah blah/);
system (import -v H02046 900) or die $!;
END DEBUG
All,
I am having some weird system call return codes and I am hoping for some
help.
when I run in debug mode a system command I get this error:
here is my debugger code
perl -dT foo
use strict;
use warnings;
$ENV{PATH} = qq (/blah blah/);
system (import -v H02046 900) or die $!;
END DEBUG
zentara
[EMAIL PROTECTED]
am.net
Hello ...
I am trying to figure out, which operator to use; pop, shift or splice.
My goal is, as an option is selected from user input, pop or splice or
shift elements off ( those selected from user input ) and repopulate array
with remaining elements.
Scenarios:
as numbers are selected
/9/05, DBSMITH wrote:
Hello ...
I am trying to figure out, which operator to use; pop, shift or splice.
My goal is, as an option is selected from user input, pop or splice or
shift elements off ( those selected from user input ) and repopulate
array
with remaining
Jay Savage
[EMAIL PROTECTED]
l.com
All,
I think I am on the right track as far as what assertion to use. I need to
print from one string to another using .. with \G
My goal is to capture from allsets down.
thank you
Here is my code:
#!/usr/bin/perl
use strict;
use warnings;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin);
open
Dave,
technically you are correct about escaping the dot, but in this particular
situation my regexp is working. I will escape the dot.
my goal again is to print from one sting to another from allsets
down. I apologize for the long output if data, but I want to reflect 100%
accuracy.
Any
yes but the problem is my start point and end point have identical entries
under them. It is stopping at original1.1 when I need for it to stop at
the end of original1.1 and print
media: sf
Volumes:
STK000
Total space available: 60.8G
as opposed to just allsets to original1.1
For
thank you,
I will consider all of these.
derek
Scott R. Godin
[EMAIL PROTECTED]
.net
All,
I am wanting to improve my code b/c I am making 3 identical system calls.
So I thought a subroutine with that one call and LABELS for each condition
would improve it.
Is this possible b/c I am getting errors stating cannot find FPR.
ok thanks but that does not really help. Sorry.
your right about finger(), but based on my code I want to execute a certain
block label
if ( mary)
finger (mary)
if (jim)
finger(jim)
or
if (mary)
finger(goto mary)
if (jim)
finger(goto jim)
Any other ideas to avoid the same system call 3
All,
I need to search a file for a string then set a variable using substr b/c
it is at a certain position, then finally replace the string with another
string.
Here is my test code:
my $gpg=qq(/home/gpghrp/.gnupg);
open (GPG, gpg --fingerprint |)
MNibble
[EMAIL PROTECTED]
de
Perl'ers
I my code I wrote a routine that executes return code signals. My point
being is if after any particular line of code make a call to check its
success or failure.
My question is if after any code system call or non system call failure
according to
$? == -1
? 127 or
$?
Yo...what up.
I have wrote this perl program to automatically download a block of strings
specifically a public key. I opted for cURL instead of lwp but may switch
as of yet.
My question is when I goto sign the new key I am prompted with as in red :
pub 1024D/886EC5AB created: 2005-03-28
what is lwp?
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Jay Savage
[EMAIL PROTECTED]
Can anyone help me with this match:
#!/usr/bin/perl
use strict;
use warnings;
my $talxkeylog =qq(/home/gpghrp/.gnupg/keys/log/talxkeyupd.log);
open (FH, +$talxkeylog) or warn unable to open file
$talxkeylog $!
;
#cURL();
#print $calcdate\n$curtdate;
my
Actually,
you are incorrect... The + mean read and write in append mode. Please
see the follow up email with the attachment I sent.
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145
bright
People of the Perl,
I have a need to develop some logic to automatically pick up a publc key
for my gpg keyring. I will use cURL ( client for URL lookups ) language
for the actual download , but the catch is the expiration time of our key
which is 2005-11-16. So I want to say if calc data =~
I whole heartedly agree!
top post rules!
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Ryan Frantz
[EMAIL PROTECTED]
[EMAIL PROTECTED]
rum-health.org
yeah thanks... company email system... Ar... notes is evil.
for that fact IBM is evil!
Dave Gray
[EMAIL PROTECTED]
Please help on how to use the functionality of my date_manip1 subroutine to
pass it the days old to
get the past date dd/mm/yy as such:
ABDELFATTAH__FAITH_M702515438: 101 dd/mm/yy
thank you,
derek
Here is my code:
use strict;
use warnings;
$ENV{PATH} =
DITTO!
THANKS Men!
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
John Doe
security.departm
All,
I want to have bold print of a Title but it is not working. Here is my
code:
require 5.6.1;
use strict;
use warnings;
use diagnostics;
use MIME::Lite;
use Term::ANSIColor;
use Logfile::Rotate;
$^T=time;
our $now = time();
our $tapes = qq(/var/tmp/volrpt.log);
our $mt=
the code
print MU color 'bold', BLAH BLAH BLAH \n;
is not working with error:
Uncaught exception from user code:
Invalid attribute name media at disk_cache-tape_slot-usage.pl line
45
Carp::croak('Invalid attribute name media') called at
/usr/perl5/5.6.1/lib/Term/ANSIColor.pm
yes of course I read it otherwise I would of not of sent an email! This is
a help list correct?
thanks
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Jay Savage
my @a=
map {$hdir.$_-[1]} # select filename
grep {$_-[0] 100} # exclude age = 100
map { [
sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
$_
] } # create aref [age, filename]
grep {$_ ne . and $_ ne ..} # exclude unwanted
sort readdir DH; # get all files
The
- Forwarded by Derek Smith/Staff/OhioHealth on 05/24/2005 03:47 PM
-
Derek
Smith/Staff/OhioH
operdir .
1 print
2 map {$_-[1].: .$_-[0].\n} # create entity output
3 grep {$_-[0] 100} # exclude age = 100
4 map { [
5 sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
6 $_
7 ] } # create aref [age, filename]
8 grep {$_ ne . and $_ ne ..} # exclude unwanted
9 sort readdir
Hi all.
This is a continuation from my original question, but with a twist. I am
now using sprintf to assign to an array, but I only want to assign to this
array of I find a number over 100 from my calculation. In the array/hash
also needs to be the directory name. Here is my code and the
Charles and the Perl beginners,
thx for the response. But how do I ,from below, convert seconds old to a
date?
From my docs Mtime shows me a timestamp of when the file was last changed.
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
ok here is what I did:
I took
(now in seconds - last MTime ) = seconds old
seconds old / ( 60x60x24)
the divisor gives me in days how old the file is.
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
I am getting this error, can anyone help?
thanks
derek
# perl -c dir.pl
Useless use of sprintf in void context at dir.pl line 29.
dir.pl syntax OK
#!/usr/bin/perl
use strict;
use warnings;
use Time::localtime;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
my $hdir =
All,
My goal is to get element 9 of stat which is mtime. I am getting this with
ease, but my end goal is to convert this number back into a readable format
giving me how old the file is.
So here is a rough draft formula : (time in seconds - last MTime ) =
seconds old.
Convert seconds old
All,
I have done some reading and know there are various way to do this, but
want to if there is an ideal way to call a non local perl script.
I know it probably matters what one is doing, but in my case all I want to
do is print the data from one script to the FH of another.
The ways I know
John,
I am a lotus user so my top-down reply is default ...sorry.
I think all looks good, but I have to ask why are you initializing an array
to hold values of a hash with keys?
This could be written the long way (but now to be read
topdown):
my @keys=keys %lookup;
* If the format of all your data lines is consistent, you could use
split
on \s+ to get the data fields instead of a tr/m cascade.
* Then, if I understand you correctly, you wantto build a hash with %
keys
and F... values. This could be done with code like
push @{$lookup_hash{$pct_value}},
I was thinking of using a hash of arrays b/c I want to look-up each array
by a certain string and that string would the % string.
My goal is to populate a hash of some sort with the % string and its
associated F string.
Here is the data file:
1 2005/01/20 15:39 17 2% -il-o-b- sg
John,
the reg exp s -+ ();
^
was changed to
y/sg//;;
y/-//d;
s{\w+} ();
to exclude the spaces and use y... thx
why are thre operators y or tr more efficient since these operators do not
use pattern matching?
Originally I was using an array,
So which is safer more ideal to use : || , or
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
John W. Krahn
[EMAIL PROTECTED]
well, I am trying to get beyond a beginner as I have doing Perl for 3
years now so is your answer still the same?
thanks,
derek
Ing. Branislav
yes I agree I was a little ambiguous... I was in a hurry. sorry. Anyway
here is my updated code. and here is a sample output:
My goal is to get all F01 which I am but I am having issues capturing all
of these values into my array. When I run the I get the data I want to see
which is just the F01
yes that is true, [5,6,7] need to be typed otherwise all entries are not
accounted for.
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145
JupiterHost.Net
perl people there was a lot of threads to my question ...thank you! I
will start from the most recent.
I took and understood the advise of my @a = (); changed to my @a;
Yes I do understand the differing precedence between or and | | . I have a
habit using | |. I do also understand that if
I am confused with your email.
what does (split) [-1] mean?
Finally,
Yes I do understand the differing precedence between or and | | . I have a
habit using | |. I do also understand that if you use or you should use (
) as opposed to | | you do not have to use ( ). Any comments?
Derek B.
all f01 records are not printed if one uses print +(split)[7]
rather print +(split)[5,6,7] will print all f01 records.
sorry
derek
JupiterHost.Net
I will answer and ask all questions in one email! k.
$!;
5 my @fa =();
6 my @ha =();
7 my $i =0;
8foreach (V4) {
Is there any good reason to slurp the entire file into memory?
What would you suggest? I want to read the entire file via a filehandle.
I have plenty of system
Please help me find the regexp to replace -o-b- - - -f
thank you!
s/sg//, s/\- {1,}(\w{1,})//,print +(split)[5,6,7], if (m/f01(\d+)/gi )
my $_ has these lines in it:
-o-b- - - -f
F01045
-o-b- - - -f
F01046
-o-b- - - -f
F01047
-o-b- - - -f
F01048
-o-b- - -f
F01049
-o-b- - - -f
F01050
Are these two statements the same?
my (@array, @array1) = ( );
my @array = my @array1 = ( );
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
I am just playing with variable assign. I always initialize my arrays
first as I need them.
thanks,
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Charles K.
Here is my code:
use strict; use warnings;
my $tpexports = qq(/usr/local/bin/ohiohealth/derek);
my $archivedexports = qq(/usr/local/log/9940exports.archived);
open (_, +$tpexports) || die could not open file:
$tpexports $!;
open (FOO, $archivedexports) || die
Perl'ers nevermind... I had a brain fart. I got it using a foreach
loop on the file.
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Derek
All,
Please audit my code as I cannot figure out the correct method to pass by
ref into my logroll subroutine.
Here is the error I am getting :
Uncaught exception from user code:
error: can not lock open: ($_) at
/usr/local/bin/ohiohealth/tapesz_chk.OH.pl line 115
All,
Here is my code:
use strict;
use warnings;
my $dev = qw/original1/;
my $dev1 = qw/clinical1/;
my $fout = qq(/usr/local/log/fuji.out);
open (OUT, +$fout) || die unable to open file: $fout $!;
open (FOO, samcmd a $dev 2\1 | ) || die unable to open pipe...
$!;
while
Wags,
come on you did not answer all my questions??? What about
I took away the + from the print and I had some errors, why is the +
infront of the split needed in Perl?
I looked in my programming perl and could not find it/.
The reason I want to use split is b/c these numbers change
Yes Wags the end result is 87, but I want to just take these two numbers
and subtract then as opposed to using the * operator . I appreciate you
efforts, but there's got to be an easier and more closely related answer to
my original code with +(split)[2].
Does anyone know the answer
1 - 100 of 255 matches
Mail list logo