I have a grow.out file showing protein ligand interaction. I converted that file into text file. It looks like:
H P L A 143 TYR 202 OH --> O2 2014 MC9 500 A
H P L A 143 TYR 202 OH <-- O2 2014 ASH 500 A
H P L A 237 SER 532 OG --> O1 2015 MC9 500 A
H P L A 237 SER 532 OG <-- O1 2015 AGM 500 A
H P L A 274 ARG 821 NH1 --> O1 2015 MC9 500 A
H P L A 278 SER 851 OG --> O2 2014 VIA 500 A
Now what I want is that the program should search for a particular ligand code (Say MC9 here). After searching for MC9 the program should print each line (row) containing MC9 into another output text file.
I am a drug design student with biotechnology background. so don't have much knowledge on programming. Please help me.
I have a code with me but is not working as the way I wanted.
#!/usr/bin/perl -w
use strict;
use IO::File;
use constant FILE => 'search.txt';
use constant FIND => 'string to find';
IO::File->input_record_separator(FIND);
my $fh = IO::File->new(FILE, O_RDONLY)
or die 'Could not open file ', FILE, ": $!";
$fh->getline;
print IO::File->input_record_separator
while $fh->getline;
$fh->close;
it is printing MC9 again and again, not the whole row