Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: parsing values from table ..using Perl

by stevieb (Canon)
on Apr 02, 2015 at 14:28 UTC ( [id://1122261]=note: print w/replies, xml ) Need Help??


in reply to parsing values from table ..using Perl

Just read and print the first line?

#!/usr/bin/perl use strict; use warnings; while (my $line = <DATA>){ next if $line =~ /Port/; print "$line\n"; last; } __DATA__ RNC RIP-IP Switch /Router Port GURRNC1 172.16.1.2 GURSW1 1/6 GURRNC1 172.16.2.2 GURSW2 2/6 GURRNC2 172.16.3.2 GURSW3 3/6 GURRNC2 172.16.4.2 GURSW4 4/6

Output:

$ ./line.pl GURRNC1 172.16.1.2 GURSW1 1/6

Now simply replace <DATA> with a real file handle. Hopefully this will be enough to get you on the right track. Your question is awfly vague though so it's difficult to know exactly what you need.

-stevieb

Replies are listed 'Best First'.
Re^2: parsing values from table ..using Perl
by get2vijay (Novice) on Apr 07, 2015 at 05:56 UTC
    Thanks a ton..stevieb !! sorry couldn't write my requirement properly as ia m very much new to this amazing perl language. i have a query...in case if the above given data is just in a plane .txt file,then what would be the solution ? please help... thanks again...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-20 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found