Edit: Do not try this code, it's got a couple of errors. See below for corrected version.
Quote:
Originally Posted by ghostdog74
you could just post your Perl solution. If OP wants a Perl solution, he will use it.
|
You're right mate. I am not sure what he wants printed out, the whole line or just part of the data, but this prints the whole line associated with the PID number:
Code:
use strict;
use warnings;
print "Enter the PID :"
my $pid = <STDIN>;
chomp $pid;
open (IN , "tes.txt");
while (<IN>) {
print if (/^\s*$pid\s/);
last;
}
close IN;
exit;