thanks for your input
I managed to have the values separated by "|"
e.g.
my $values = (value1 | "value two" | value3 | "value four);
- now I can process them properly.
As Kevin states - one double-quote to much - end there is a mess
Cheers - Dietmar
Hi,
following situation I ran into -
my $values=(value1 "value two" value3 "value four)
How can I split to receive following result
value1
value two
value3
value four
to be able to compute them.
I had in my script
my @lines = split(/ /,$values);
foreach (@values){
....
}
but this...
I run in a regex problem
the regex from example above
if (m/^\[(\w+)]/) { # Find Chapter names
does not map lines with the - character in the name.
e.g.
[Chapter1]
is mapped but
[Chapter-2]
or
[Chapter-New-3]
is not mapped.
How doese the regex to be altered to map all lines
starting with...
from example script and config aboth.
I added following to retrieve the keys of the hash
my @KEY = keys %config;
print "@KEY\n";
The return is:
#NodeGroupDefault CUSTOMER_GROUP Assignment_Windows Assignment_Linux
Then I try to read the value of eg "Assignment_Windows"
print...
...my $config;
my $chapter;
sub get_config{
{
open(CONF,"<$conffile") or die "Cannot open $conffile\n";
while (<CONF>) {
next if /^\s*$/; # Blank line
next if /^\s*#/; # Comment
s/^\s*//; # Remove leading spaces
s/\s*$//; #...
Endusers shell be able to modify entries in the different chapters of the config file easy - thats why we thought to use this classic form of input config file
...open(CONF,"<$conffile") or die "Cannot open $conffile\n";
while (<CONF>) {
chomp; # no newline
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length; # anything left?
if ( "$_" eq...
Hi,
I generated a new Logfile Policy and loaded it using the opccfgupld command. I don't like to use the GUI.
With which command can I distribute LogfilePolicies to certain nodes?
Rgds - Dietmar
Ups - to make it more clear, what result I'm looking for.
I need to be able to process the generated lines of numbers.
I thought, if I push the result to a new array, it would work. Here's the code.
#!/usr/bin/perl -w
use strict;
my $ERRFILE = "d:/errorcode.lst";
my $ERROR;
my $i;
my @list...
Hi - thanks, that works. One more question.
Is it possible to put the lines generated into an array, so I can use them for further processing. I tried
while (<DATA>) {
push(@errorcode, $1, (++$i % 5 and not eof ) ? "|" : "\n" if /errorcode=(\d+)$/);
}
and receive following error:
syntax...
Thanks for the responses.
Stevexxf, when I run your code it produces following output:
101|222|333|444|555
666|777|888|999|000
123|234|567|890|987
342|478|
How would I get rid of the last | .
I must not have lines ending with a | .
Rgds - Dietmar
Hi,
I've run into following problem.
I need to process a list, and print every 5 errorcodes in one row and all errorcodes separated by a |. This is the list.
##############
#errorcode.lst
##############
errorcode=101
errorcode=222
errorcode=333
errorcode=444
errorcode=555
errorcode=666...
Hi,
I found a tool to help visualize/create perl regular expression. It is freeware for private non commercial use and is available to download for Linux and Windows OS.
http://weitz.de/regex-coach/
Dietmar
The line I'm matching is not perl code. It's from a file which is used by a logfile parsing tool (from IBM Tivoli) containing defintions. (which logfile entries should be found and what messages should be send to a central console - as info for the system admins).
For documentation purpose I...
Hi Kevin,
your regex works, if you put the backslashes in front of the quotes.
#!/usr/bin/perl
my $line = "msg PRINTF(\"syslogd: %s: No space left on device\", logfile)";
my ($new) = $line =~ /"([^"]+)"/;
print $new;
syslogd: %s: No space left on device
But without the quotes (as my original...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.