Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • shubk
    Junior Member
    • Aug 2018
    • 5

    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
  • finswimmer
    Member
    • Oct 2016
    • 60

    #2
    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

    Comment

    Latest Articles

    Collapse

    ad_right_rmr

    Collapse

    News

    Collapse

    Topics Statistics Last Post
    Started by SEQadmin2, 06-05-2026, 10:09 AM
    0 responses
    12 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-04-2026, 08:59 AM
    0 responses
    24 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-02-2026, 12:03 PM
    0 responses
    28 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-02-2026, 11:40 AM
    0 responses
    22 views
    0 reactions
    Last Post SEQadmin2  
    Working...