> -----Original Message----- > From: s wang [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 04, 2002 11:00 AM > To: [EMAIL PROTECTED] > Subject: how can i get rid of these new line characters? > > > > i have just started writing some scripts in PERL and i am > trying to catch a deadline, i really wish i could get some > help for this problem. any suggestion is greatly appreciated. > > i have a set of files with sequences aligned in the following > format. i wonder how i can eliminate the new line characters > within each sequence without touching those between sequences?
Here's an attempt at a one-liner that does what I think you want: perl -000 -i.bak -lpe 's/(?<=\n)(.*?)\n/$1/g' myfile It reads and writes by "paragraphs". It then strips the newlines after the first, since it appears you want the first line of each paragraph to remain a separate line. > > ..... > > 2 chr1 10761 10775 chr19 46520370 46520384 + 941 > acaGGAAAAGAACAA > acaggaaaagaaggg > > 3 chr1 10776 11241 chrUn 45411478 45411944 - 12857 > AAGAAGGAAGAAGAGGGTAGAGGAGAAGTGCAGCAAGGGTGGAGGGAGGTGCCCGCGCTGGG > TCGGAGGAGCAGGAGTAT > GGAGGGAAGACTCCTGGGTGGCATGGAGCTCTTGCACCTCTAGGCACTGCCCAGCCCTGTGT > CAGCCAGGGCTGAACCCCCACAGGATAAGGAACCTGTGTGTGTGACCAACAATCAAAG > CTACATCTGTGACACAACAGGACACTGCTATGGGCAGTCTCAGTTCTGGCTCGCGTGGACCA > TCACCATCA > TCCTGAGCTGCTGCTGTGTCTGCCACCACAGCCAAGCCAGCCCTCAAGTCCAGCAGTAGCAA > CATGAAATCAA > CCTGCCTGCCTATCCAGAAGCCCGCAATTACTCAGTGCTACCATTTTATTTCACCAAACTAT > TTATTACCTT > CTTATGAGGAAGTGGTGAAC > AAGAAGGAAGCAGAGGGAAGAAGAAATGAAGGAGGAGGGTGATAGTGCCATGGTGGAGAAACAGGAGGAG > CAGGGGCAGGGGCACTCTACACTGGACACTGTAGTGGACAGTCTCAGTGCTCCAGCTCTGAA > TTCTGGTATAAGTCCTTGCCTAGGGAGTTATTGGCATCCCAGGGTCTCAGTTACTGCCTCTG > CTCCACAGGCAGAGG > AAAGCATGGGGTGTCCAGCCTTTTCTCACTCTTAGGGACAATGTTGACTTCTGACTGATGTG > GACCATCATCATCT > TCCGGAGCTGCTGCTGTGTCTGCCACCAATGCTGAGCCCAGGCACTGCCTTCAGACCCAGCA > ATGACAGCATGAAATCAA > ATTGATGGCCTACCAGGAAGCCCACAATTACTCATCACTGCCATTTTAGTTCAGGTTTTTGC > CAAACTATTTATTACCTC > CTTATGAGGAAGTGATGAAC > > 4 11242 11268 25467376 25467402 - 294 > TAACCTCCACCTGTTTCCCTCCCTGTC > ATCTTCCAATCCCTTCCCCACCCTACC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]