
cmccabe1
Novice
Jan 23, 2014, 7:14 AM
Post #1 of 4
(2594 views)
|
new line after comma
|
Can't Post
|
|
I use the code below to output the attached output. My question is if there are multiple hits separated by a comma, how can they be each a new row? For example, chr2 39222264 39222264 - A 39222271 G 39222507 T 39222423 would be: chr2 39222264 39222264 - A 39222271 chr2 39222264 39222264 - G 39222507 chr2 39222264 39222264 - T 39222423
cat sequences_4homopolymers.txt | perl -aF/\\t/ -lne '($chr,$st)=$F[0]=~/(chr\w+)\:(\d+)/ && ($1, $2);%k=map $F[1]=~m/$_{4}/i?($_,length($`)):(), qw(A G C T); print join("\t",$chr,$st,$st,"-",map "$_\t".($st+$k{$_}),sort keys %k)' >4hp.txt Thank you.
|