J
jamasd
Here is a sample of my data (each column is separated by tabs):
1234123 jaesdf ytkyk 345234
1264345 ghgfdf ghjhg 657658
3456765 sdasdf ytkyk 456543
1231232 assffg werwe 123454
5447454 asdqfr ytkyk 254364
I am interested in creating a hash with two of the elements in the
list ("ytkyk" and "ghjhg"). I would like to create a program to read
only the third colomn and print the line (row) if it contains one of
the latter items. Can anyone help me write a program. Here is what I
have so far and I would like to create a more efficient program (I am
going to use it for writing a larger program later):
open( File, '<', 'file.txt' ) or die "$!\n";
while ( <File> ) {
next unless ( index($_, 'ytkyk') >= 0 );
next unless ( index($_, 'ghjhg') >= 0 );
print;
}
close( File );
Thank you very much.
1234123 jaesdf ytkyk 345234
1264345 ghgfdf ghjhg 657658
3456765 sdasdf ytkyk 456543
1231232 assffg werwe 123454
5447454 asdqfr ytkyk 254364
I am interested in creating a hash with two of the elements in the
list ("ytkyk" and "ghjhg"). I would like to create a program to read
only the third colomn and print the line (row) if it contains one of
the latter items. Can anyone help me write a program. Here is what I
have so far and I would like to create a more efficient program (I am
going to use it for writing a larger program later):
open( File, '<', 'file.txt' ) or die "$!\n";
while ( <File> ) {
next unless ( index($_, 'ytkyk') >= 0 );
next unless ( index($_, 'ghjhg') >= 0 );
print;
}
close( File );
Thank you very much.