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...