How to display only the chains (such as A, C, E, G
) which end with a semicolon ;
Data
COMPND MOL_ID: 1;
COMPND 2 MOLECULE: JACALIN;
COMPND 3 CHAIN: A, C, E, G;
COMPND 4 SYNONYM: JACKFRUIT
AGGLUTININ;
COMPND 5 MOL_ID: 2;
COMPND 6 MOLECULE: JACALIN;
COMPND 7 CHAIN: B, D, F, H;
COMPND 8 SYNONYM: JACKFRUIT AGGLUTININ
I tried the below code
#!usr/local/bin/perl
open(FILE, "/home/httpd/cgi-bin/r/1JAC.pdb");
while ( $line = <FILE> ) {
if ( $line =~ /^COMPND/ ) {
#$line = substr $line,4,21;
my $line =~ m(/\$:^\w+\$\;/g);
print $line;
}
}
This is a fairly simple method of "grepping" part of a line to standard output. It will capture everything in the parentheses and print it.
-n
uses awhile(<>)
loop to read data from your file-l
handles newlines