The following code does no checking to insure the format is correct.
This is left as an excerise for the reader.
<code>
#!/usr/bin/perl -w
use strict; #make me behave
my $first = 1;
my $line;
while (<>) { #read lines from stdin or files listed
#on cmd line
chomp; #remove \n
if (s/^>//) { #replace leading >, this has a side effect
#of telling us that is a name
unless ($first) { #unless this is the first line
chop $line; #remove trailing .
print "$line\n"; #done with this name
}
$first = 0; #make sure we know that this is no longer
#the first line
$line = "$_\t"; #set name followed by tab
} else { #if this is a line line
$line .= "$_."; #append line (note we need to remove the
#last . at the end, see line 13
}
}
chop $line; #remove trailing .
print "$line\n"; #last line needs printing
</code>
On 14 Jun 2001 16:54:11 -0400, Pedro A Reche Gallardo wrote:
> Hi to everyone, I have a file that it looks like this
>
> >name1
> line 1
> line 2
> >name2
> line a
> line b
>
>
> and I want it to look this way
>
> name1 line1.line2
> name2 linea.lineb
>
>
> Anyone help welcomed
> Greetings,
>
> Pedro
>
>
>
> --
> ************************************************************************
> ***
> PEDRO a. RECHE gallardo, pHD TL: 617 632
> 3824
> Scientist, Mol.Immnunol.Foundation, FX: 617 632 3351
> Dana-Farber Cancer Institute, EM:
> [EMAIL PROTECTED]
> Harvard Medical School, URL: http://www.reche.org
> 44 Binney Street, D610C,
> Boston, MA 02115
> ************************************************************************
> ***
>
>
--
Today is Setting Orange, the 19th day of Confusion in the YOLD 3167
Grudnuk demand sustenance!