On Thu, Apr 25, 2002 at 02:34:55PM +0200, [EMAIL PROTECTED] wrote:
> hi,
>
> i have a data file test1.txt as follows:
>
> 551356835||1|7684940|47534900|0
> ..
>
> my code should open test1.txt, read in the data, convert it an print it into
> test2.txt :
>
> ($nodeid, $nameid, $type
hi,
try escaping the |
split ("\|", $line);
hope this works
sgb.
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 6:04 PM
Subject: problems with split
hi,
i have a data file test1.txt as follows:
551356835||1|7684940|47534
> ok, Appologies to all for not having included the whole thing, but
here...
The script you attached has 'i' in several places where there should be
'$i'.
Search thru it for {i}.
ok, Appologies to all for not having included the whole thing, but here...
the script is for collecting customer interface stats using snmp, and
I need to destinguish what type of router the customer connects to in
order to have the right MIB. It runs with a cfg file which I have
included, which
: what should be $router_table{$i} ?
Sorry for the typo. Should be $router_tables{$i}. In the code you
posted, you don't have a dollar sign on the i.
-- tdk
On Thu, May 24, 2001 at 01:21:47PM +0100, Andy Roden wrote:
>
> Anyone help out...
>
> %router_tables is something like (1.1.1.1|cisco, 2.2.2.2|juniper etc)
>
> foreach $i (sort keys %router_tables)
> {
> next if ($i =~ "unknown");
> ($router_table{i},$router_type{$i}) = split(/
> [confusion]
Andy,
You really ought to paste in the actual code
causing the problem rather than retyping it.
While you are about it, make sure to include
the code that populates %router_tables.
what should be $router_table{$i} ?
I have $router_tables{$i} (with the s) which is something like
1.1.1.1|cisco and I want to split it to be $router_table{$i} (without the
s) is 1.1.1.1 and $router_type{$i} is cisco
Andy
On Thu, 24 May 2001, Timothy Kimball wrote:
>
> Andy Roden wrote:
> :
Andy Roden wrote:
: For some reason, the script doesn't execute the split as I would hope
: (giving $router_table{i} = 1.1.1.1 $router_type{i} = cisco) it just
: returns two blanks (and hence prints out the $router_tables{$i} as its
: told to
Should be $router_table{$i}, shouldn't it?
-- tdk