rockyurock has asked for the wisdom of the Perl Monks concerning the following question:
Variables to read from Excel sheet : isim = usim = sim_invalid = pcscf_discovery_flag signaling_flag ran_type emergency_ind rat pcscf_v4 pcscf_v6 plmn is_ems_support ipv4 ipv6
MY program:My input data to search from: 8077 8116 D type hexa usim = 1, isim = 1 8077 8116 D type hexa usim = 1, isim = 1 pcscf_v4 : num = 2, protocol_type = 0x21, port_num = 0, addr = 10.56.5 +.85 8088 1223 D temp sim_invalid = 0 8099 1223 XX is_ems_support = 1 #88 8099 1224 XX pdn_act_ind->pcscf_discovery_flag = 1 ind->signaling_flag = 1 some text here plmn = 405872 DefaultStatusBarPlmnPlugin: into updateCarrierLabel ipv6 = 36.5.2.4.25.143.200.141.0.0.0.0.32.20.232.161 get_ipv6_prefix,temp ipv4 = 10.167.185.101 _send_ipv4_notify
#use strict; #use 5.010; use Spreadsheet::Read qw(ReadData); my $book = ReadData ('UE_NW_Parameters.xlsx'); #my @files = grep { -f } (<*.txt>,<*main_log>,<*Project>,<*properties> +); my @files = grep { -f } (<*main_log>); my @rows = Spreadsheet::Read::rows($book->[1]); foreach my $i (1 .. scalar @rows) { foreach my $j (1 .. scalar @{$rows[$i-1]}) { my $temp = "\n$rows[$i-1][$j-1]"; my @keywords = "$temp"; print @keywords; } foreach my $file (@files){ open(my $fh, '<', $file) or die $!; my @content = <$fh>; close($fh); my $l = 0; foreach my $kw (@keywords) { foreach (@content){ $l++; my $search = $kw; if ($search =~ /(\ d+)/) { printf 'Found keyword %s in file %s, line %d:% +s'.$/, $search, $file, $l, $_; last; } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to read the value of a variable (read from a Excel file converted Into text file) and put then back into Excel column
by thanos1983 (Parson) on Feb 17, 2017 at 15:01 UTC | |
by rockyurock (Acolyte) on Feb 20, 2017 at 13:30 UTC | |
by poj (Abbot) on Feb 20, 2017 at 13:42 UTC | |
by rockyurock (Acolyte) on Feb 23, 2017 at 07:37 UTC | |
by rockyurock (Acolyte) on Feb 23, 2017 at 09:23 UTC | |
|