SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
pheatmap with predefined row order (?) IsBeth Bioinformatics 1 02-25-2017 11:54 AM
DESeq2 column/row arrangement bioBob Bioinformatics 3 03-06-2014 06:41 AM
Pindel output Row 32+ per sample details millerrruth Bioinformatics 3 02-24-2014 02:52 PM
VCF row validity warindrarto Genomic Resequencing 2 08-27-2013 12:45 AM
DESeq no recognizing row.names alisrpp Bioinformatics 9 05-27-2013 01:04 PM

Reply
 
Thread Tools
Old 12-31-2018, 01:32 AM   #1
shubk
Junior Member
 
Location: India

Join Date: Aug 2018
Posts: 5
Default How to start a new column after every nth row?

Hi have a file(comma separated) with 3 columns. I want to start new column after every 4th row
Input:
col1,col2,col3
1,disease1,high
1,disease2,low
1,disease3,high
col1,col2,col3
2,disease1,low
2,disease2,low
2,disease3,high

Expected output:
col1,col2,col3,col1,col2,col3
1,disease1,high,2,disease1,low
1,disease2,low,2,disease2,low
1,disease3,high,2,disease3,high
shubk is offline   Reply With Quote
Old 01-01-2019, 01:04 PM   #2
finswimmer
Member
 
Location: Europe

Join Date: Oct 2016
Posts: 56
Default

This should be possible with some unix commands and datamash.

Code:
cat input.txt|paste - - - -|datamash transpose --output-delimiter , > output.txt
This will for lines into one line. Than we use datamash to transpose this new table.

fin swimmer
finswimmer is offline   Reply With Quote
Reply

Tags
command line, linux, perl, shell

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 03:38 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO