D
doni
I wanted to extract the 3rd field from every 2nd and 3rd line after
spaces from a file. This is how the information is stored in the file.
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 108
00009c4 15 114
00009c8 15 119
00009c8 15 109
00009c4 15 114
00009c8 15 119
00009c8 15 109
00009c4 15 114
00009c8 15 119
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 107
00009c4 15 114
00009c8 15 119
Here is the script that I have written to approach the problem. The
script is not a complete one.
#! /usr/bin/perl -w
$ex_data = "extract_data";
# Open the rfping data file #
open(DAT,$ex_data) || die("Cannot Open File");
foreach my $line(<DAT>)
{
chomp $line;
my @data = split(/\s+/,$line);
my @rssi_09c8_09c4;
if ($data[0] eq "00009c4")
{
@rssi_09c8_09c4 = $data[2];
print "The rssi value is: @rssi_09c8_09c4\n";
}
else
{
}
}
close(DAT);
The other problem is when I run this script, I am getting "Use of
uninitialized value at ./rfping.pl line 13," warning message.
Can anyone let me know how should I proceed with this.
Thanks,
doni
spaces from a file. This is how the information is stored in the file.
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 108
00009c4 15 114
00009c8 15 119
00009c8 15 109
00009c4 15 114
00009c8 15 119
00009c8 15 109
00009c4 15 114
00009c8 15 119
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 106
00009c4 15 114
00009c8 15 119
00009c8 15 107
00009c4 15 114
00009c8 15 119
Here is the script that I have written to approach the problem. The
script is not a complete one.
#! /usr/bin/perl -w
$ex_data = "extract_data";
# Open the rfping data file #
open(DAT,$ex_data) || die("Cannot Open File");
foreach my $line(<DAT>)
{
chomp $line;
my @data = split(/\s+/,$line);
my @rssi_09c8_09c4;
if ($data[0] eq "00009c4")
{
@rssi_09c8_09c4 = $data[2];
print "The rssi value is: @rssi_09c8_09c4\n";
}
else
{
}
}
close(DAT);
The other problem is when I run this script, I am getting "Use of
uninitialized value at ./rfping.pl line 13," warning message.
Can anyone let me know how should I proceed with this.
Thanks,
doni