hi list,
I need help for this script, i think it's more of my regex construct error;
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
while(DATA) {
if(/CDiscoverySource.*WKSMDE[0-9]+/is) {
print $_;
}
}
__DATA__
rocessing System #7... $$SMS_DISCOVERY_DATA_MANAGERFri
Hi.
Sorry to bother but I can't get this script to work..
It is supposed to parse the openvpn config,
1) any line starting with a ; is to be ignored
2) all directives are written to a hash where the key is the directive and
the value is the value of the directive .
3) if the directive is
Hello,
Follow the conditions,the resolving way is not so complicated as yours.I
would give my sample way,hope it's useful to you.
here is the config file's content:
$ cat config.txt
;test file
# comment lines
IP = 1.2.3.4
PORT = 80
PREFORK_CHILDS = 5
MIN_SPARE_CHILDS
here
looks good but my configs don't us = there is just a space ... so could
one use my ($key,$value) = split/\ /; to split the kay and the value ?
On 7/14/06, Jeff Peng [EMAIL PROTECTED] wrote:
Hello,
Follow the conditions,the resolving way is not so complicated as yours.I
would give my sample
Could you paste your config file here?Then we could look at the situation
more clearly.
looks good but my configs don't us = there is just a space ... so could
one use my ($key,$value) = split/\ /; to split the kay and the value ?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
here is basic config
All lines starting with ; or # are to be regarded as commented out ... as
are ignored..
client ### some of the directives are set jst by there
pressence
;dev tap
dev tun0
;dev-node MyTap
proto tcp
;proto udp
remote 192.168.1.1 1194
;remote my-server-2
Since there are the parameters which have multi-values,you could store the
values in an array and use this array's reference as hash's value.For
example:
while(HD){
next if /^\s*#|^\s*;/;
next if /^\s*$/;
my @array = split/\s+/;
my $key = shift @array;
$hash{$key} = [EMAIL
Just to check my understanding and that i'm learning this rite . :-)
while(HD){
next if /^\s*#|^\s*;/; ignors any lines with # and ;
next if /^\s*$/; ignores lines that start with a
space ..
my @array = split/\s+/;... puts each value seperated
Jeff Peng schreef:
next if /^\s*#|^\s*;/;
next if /^[[:blank:]]*[#;]/ ;
next if /^\s*$/;
next if /^[[:blank:]]*$/ ;
my @array = split/\s+/;
my @array = split ;
Simpler would be to remove any blanks from the start end end of the line
first:
I was wondering if there is a quicker way of getting a directory listing
from a disk. I am currently doing the following but it takes a bit of
time if I happen to have to search multiple 250Gb drives.
#
# Trying to locate tests on the systems disks and establish paths to
them;
#
$i = c
On 14/07/06, Mathew Snyder [EMAIL PROTECTED] wrote:
Mike Martin wrote:
On 13/07/06, OROSZI Balázs [EMAIL PROTECTED] wrote:
Hi guys!
I'm a total Perl beginner, and I delete most mails, as either I cannot
answer or I'm not interested. I'm reading through this thread from the
Trash folder,
Ed Panni wrote:
: I was wondering if there is a quicker way of getting a directory
: listing from a disk. I am currently doing the following but it
: takes a bit of time if I happen to have to search multiple 250Gb
: drives.
You are searching through a lot of files. Perhaps the best way
to
Gregory Machin wrote:
Hi.
Hello,
Sorry to bother
No bother. :-)
but I can't get this script to work..
It is supposed to parse the openvpn config,
1) any line starting with a ; is to be ignored
2) all directives are written to a hash where the key is the directive and
the value is the
Dr.Ruud wrote:
next if /^\s*$/;
next if /^[[:blank:]]*$/ ;
Why do you prefer /[[:blank:]]/ over /\s/ Ruud? I can't see the point in
treating CR, LF and FF as valid data. Anyway, I would prefer:
next unless /\S/;
which says it all.
Rob
--
To unsubscribe, e-mail: [EMAIL
Ed Panni wrote:
I was wondering if there is a quicker way of getting a directory listing
from a disk. I am currently doing the following but it takes a bit of
time if I happen to have to search multiple 250Gb drives.
# Trying to locate tests on the systems disks and establish paths to
Rob Dixon schreef:
Dr.Ruud:
next if /^\s*$/;
next if /^[[:blank:]]*$/ ;
Why do you prefer /[[:blank:]]/ over /\s/ Ruud?
[[:blank:]] is TAB + SP only (for ASCII).
I can't see the point
in treating CR, LF and FF as valid data.
LF won't happen in this context ($ matches before
Rob Dixon schreef:
chomp (my @files = qx($command));
chomp @files;
Why twice?
print $_\n foreach @files;
unchomp? ;)
Variant:
{ local ($\, $,) = (\n, \n); print @files }
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
Mumia,
thanks for your work on answering my help request. I really
appreciate it. However, while your solution works perfectly in your
sample program, since I am new to perl, I am having trouble
understanding some of the techniques you used, and i am having trouble
integrating the solution
Run 'perldoc perlop' at the command-line.
Check out the section about the Conditional Operator for the first
question, and the second question will be under Quote and Quote-like
Operators, in the m/PATTERN/cgimosx section.
-Original Message-
From: Ryan Moszynski [mailto:[EMAIL
Hi:
I have a filenames such as NQSname_l_cs.txt, NQSname_l_da.txt, NQSname_l_zh-
tw.txt etc.
I would like to modify these filenames such that they are NQSname.txt
What regex i could use to modify these filenames?
Thanks much.
Here's one way to do it:
#
if($file =~ /^NQSname.+\.txt$/){
rename ($file,'NQSname.txt');
}
#
-Original Message-
From: Nishi Bhonsle [mailto:[EMAIL PROTECTED]
Sent: Friday, July 14, 2006 5:29 PM
To: beginners perl
Subject: strip
Hi:
I have a filenames such as
Nishi Bhonsle wrote:
Hi:
Hello,
I have a filenames such as NQSname_l_cs.txt, NQSname_l_da.txt,
NQSname_l_zh-
tw.txt etc.
I would like to modify these filenames such that they are NQSname.txt
What regex i could use to modify these filenames?
s/_.*\././;
John
--
use Perl;
program
John W. Krahn wrote:
s/_.*\././;
Sometimes Perl regexes start to look like ASCII art!
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
On 07/14/2006 06:04 PM, Ryan Moszynski wrote:
Mumia,
thanks for your work on answering my help request. I really
appreciate it. However, while your solution works perfectly in your
sample program, since I am new to perl, I am having trouble
understanding some of the techniques you used, and i
On 07/14/2006 06:04 PM, Ryan Moszynski wrote:
Mumia,
thanks for your work on answering my help request. [...]
You're welcome.
how do i get all of this inside my if statement? [...]
Here's another example:
my @data = ('1-10;25;33;100-250', '1-10;25;33;x100-250',
25 matches
Mail list logo