Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: Multiple Rows

by PilotinControl (Scribe)
on Oct 05, 2013 at 21:04 UTC ( #1057081=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Multiple Rows
in thread Multiple Rows

do not really need the scroll text bars...all is needed is to search the host file and have a header with the results posted below:
IP ADDRESS | PORT | TCP
192.168.1.1

Thats more like the out put I am seeking thanks.


Comment on Re^4: Multiple Rows
Re^5: Multiple Rows
by mtmcc (Hermit) on Oct 05, 2013 at 21:31 UTC
    This will remove the scrollbars:

    #!/usr/bin/perl use strict; use warnings; use Tk; use Tk::ROText; use Tk::Table; my $hdb; my $window = MainWindow->new; $window->title("Host Report"); my $labs = $window->Table(-columns => 3, -fixedrows => 6, -fixedcolumn +s => 4, -rows => 5)->pack(-side => 'bottom'); $labs -> put (1, 1, "Results"); $window->Entry(-textvariable => \$hdb )->pack; $window->Button(-text => "Go", -command => \&host )->pack; $window->Button(-text => "Quit", -command => \&stop )->pack; MainLoop; sub host { #open (FH, "<", "host.txt"); my $row = 2; my $col = 0; my $x = 0; my @lines = <DATA>; print STDERR "@lines\n\n"; #close FH; foreach my $hdb2 (@lines) { chomp $hdb2; my @field = split(':',$hdb2); #if ($field[0] =~ /(?<![\w-])$hdb(?![\w-])/i) { for ($x=0; $x <=2; $x += 1) { $field[$x] = '' unless defined $field[$x]; my $tempLabel = $labs->Label(-text =>"$field[$x]", -anchor => +'w'); $labs->put($row, $x, $tempLabel); } $row += 1; #} } } sub stop{ exit; } __DATA__ these:lines are:the:lines that:you are:looking:at

    I hope that helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057081]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2014-09-20 00:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls