PerlAmateur has asked for the wisdom of the Perl Monks concerning the following question:
Hi, i'm new in Perl. Now the problem. I've a file, that in some lines with the string "HEADER", every time that i found this I want to create a new file and Remove the line from the new file. The name of the output file would be the string "SEQUENCE .........." where "........" are the alphabets present after each header and the four letter code 1A9L. for eg. the input file looks like this
HEADER2 RNA 1998-04-07 1A9L EXPDTA NMR REMARK 0 RES. NO. 15 - 24 REMARK 0 SEQUENCE GUCGAGAGAC REMARK 0 2DSTRUCUTRE (((....))) REMARK 0 CHAIN A ATOM 455 P G A 15 53.709 19.513 10.553 1.00 2.13 + P ATOM 456 OP1 G A 15 54.206 19.249 11.925 1.00 2.47 + O ATOM 457 OP2 G A 15 53.091 20.834 10.264 1.00
and i want the output file to be named as GUCGAGAGAC and content should be
ATOM 455 P G A 15 53.709 19.513 10.553 1.00 2.13 + P ATOM 456 OP1 G A 15 54.206 19.249 11.925 1.00 2.47 + O ATOM 457 OP2 G A 15 53.091 20.834 10.264 1.00
please help
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Create multiple files from a single file
by moritz (Cardinal) on Feb 21, 2012 at 11:33 UTC | |
|
Re: Create multiple files from a single file
by JavaFan (Canon) on Feb 21, 2012 at 11:48 UTC |