in reply to separate files

G'day crayfish,

Welcome to the monastery.

As already pointed out in previous replies (and a private message), there's a number of problems with what you've posted that makes it difficult for us to know exactly what you need help with.

You've presented your data as a string. Delving into the HTML source, I see it's actually formatted into a number of records. choroba sent you a private message about <code>...</code> tags; if you don't know how to update your post, see "How do I change/delete my post?".

In addition to the formatting of the data, there's potentially a problem with its accuracy. Note "seq1" (without underscore) and "seq_2" (with underscore). I'll leave you to fix that, if necessary.

Your description of the required output is also somewhat vague. For instance, did you want all, some or none of the ">b_comp_..." headers included? It's much better to provide a small example of what you're expecting.

Please read the guidelines in "How do I post a question effectively?". If you post a question with all the appropriate information, you're likely to get good answers in (generally) a short space of time. You might also like to look at "How (Not) To Ask A Question" which explains, in more detail, some of the issues with your original post.

The following code presents techniques that may be suitable for your current needs. It's intentionally generic because, as stated, it's unclear exactly what you want.

#!/usr/bin/env perl use strict; use warnings; my ($group_size, $group) = (2, 0); local $/ = "\n>"; while (<DATA>) { print '*** Filename: XYZ_', ++$group, "\n" unless ($. - 1) % $grou +p_size; chop; print '>' unless $. == 1; print; } print "\n"; __DATA__ >b_comp_seq1 ACGCGGGGGAATTT >b_comp_seq_2 ACGGGCTTTCACC >b_comp_seq3 ACGCGGGGGAATTT >b_comp_seq_4 ACGGGCTTTCACC

Output:

*** Filename: XYZ_1 >b_comp_seq1 ACGCGGGGGAATTT >b_comp_seq_2 ACGGGCTTTCACC *** Filename: XYZ_2 >b_comp_seq3 ACGCGGGGGAATTT >b_comp_seq_4 ACGGGCTTTCACC

Finally, I don't know what expertise you have with Perl. A good starting point for reference documentation is perldoc.perl.org: it begins with an introduction, tutorials and FAQs; more in-depth discussions of topics follow. When you've actually written some code, feel free to ask about any specific difficulties you encounter.

-- Ken