if i have the following:
>A13P0
ACCATAGAGAG
CCCGAGATTTA
>03HK2
ACACAGTGTGT
TTAGAGGGAGA
How do I merge lines that do not begin with >
?
i.e.
>A13P0
ACCATAGAGAGCCCGAGATTTA
>03HK2
ACACAGTGTGTTTAGAGGGAGA
thanks!
perl -ne'
if (/^>/) {
print("\n") if $. != 1;
} else {
chomp;
}
print;
} {
print("\n") if $. != 1;
'
See Specifying file to process to Perl one-liner for usage.
I know this has been asked/answered a thousand times but I can't find it so:
$ awk '/^>/{print (NR>1?ORS:"") $0; next} {printf "%s", $0} END{print ""}' file
>A13P0
ACCATAGAGAGCCCGAGATTTA
>03HK2
ACACAGTGTGTTTAGAGGGAGA
with a perl command line:
perl -pE '$.>1 && !s/^>/\n>/ && chomp; END{say}' file
With sed :
$ sed ':a;$!N;/>/!{s/\n\([^>]\)/\1/;ta};P;D' file
>A13P0
ACCATAGAGAGCCCGAGATTTA
>03HK2
ACACAGTGTGTTTAGAGGGAGA