Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8854639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:55:49+00:00 2026-06-14T13:55:49+00:00

I have a tab delimited file, in which the first 10 columns are always

  • 0

I have a tab delimited file, in which the first 10 columns are always present and stay at same position, but after the 10th column, the number of columns can change. I want to retain the first 10 columns as is and concatenate the rest of the columns into one column separated by |.

Here is the sample data:

columns: col1 col2 … col 10 col11 col12 col13

Values: 1 2 … 10 11 12 13

Result:

Columns: col1 col2 … col10 col11|col12|col13

Values: 1 2 … 10 11 | 12 | 13

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:55:50+00:00Added an answer on June 14, 2026 at 1:55 pm

    Take a look at ruby’s split method – it takes an optional limit parameter. Assuming your data is in a variable row for each line:

    values = row.split("\t", 11)
    

    Example (with the variable part starting at column 3 for brevity):

    s = "1\t2\t3\t4" 
    cols = s.split("\t", 3) 
    # result: ["1", "2", "3\t4"] 
    

    Then you can change the last element in place:

    cols[2] = cols.last.gsub("\t", "|")
    # cols is now: ["1", "2", "3|4"] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab delimited file, for which I need to concatenate selective columns
I have a tab delimited file in which starting from columns 10-25 some of
I have a tab delimited file which looks like this: CHROM <TAB> POS <TAB>
After spliting a tab delimited file I have my required values in a string
I have a file like this (tab delimited), but many lines 1314 0 0
I have a text file with tab delimited data spread across 16 columns. I
I have a tab delimited file with 5 columns and need to retrieve a
I have a tab-delimited text file that I am parsing. Its first column contains
I have a tab delimited file which looks like this: ABCA2 chr9 139021506 139043195
I have a large file named CHECKME which is tab delimited. There are 8

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.