View Single Post
Old 11-30-2020, 05:59 AM   #2
gcR
Member
 
Location: Montevideo

Join Date: Mar 2017
Posts: 15
Default

I got this answer from another forum, so I add it here in case someone needs it.

input:
Quote:
$cat test.txt

Predicted_APA.TOTAL Loci.TOTAL
41867799,41867388,41866990 chr17:41866927-41867904
output:
Quote:
$awk -v FS='[-:\t]' -v OFS="\t" ' NR != 1 {split($1,a,","); for (i in a) {print $2,$3"-"a[i],$3,a[i]}}' test.txt

chr17 41866927-41867799 41866927 41867799
chr17 41866927-41867388 41866927 41867388
chr17 41866927-41866990 41866927 41866990
__________________
Beginner @ RNA-Seq, R programming, Linux, Python.-

Please be patients!
gcR is offline   Reply With Quote