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

  • Home
  • SEARCH
  • 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 8210915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:14:41+00:00 2026-06-07T10:14:41+00:00

I have a file like the following: Header1:value1|value2|value3| Header2:value4|value5|value6| The column number is unknown

  • 0

I have a file like the following:

Header1:value1|value2|value3|
Header2:value4|value5|value6|

The column number is unknown and I have a function which can return the column number.

And I want to write a script which can remove one column from the file. For exampple, after removing column 1, I will get:

Header1:value2|value3|
Header2:value5|value6|

I use cut to achieve this and so far I can give the values after removing one column but without the headers. For example

value2|value3|
value5|value6|

Could anyone tell me how can I add headers back? Or any command can do that directly? Thanks.

  • 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-07T10:14:43+00:00Added an answer on June 7, 2026 at 10:14 am

    Replace the colon with a pipe, do your cut command, then replace the first pipe with a colon again:

    sed 's/:/|/' input.txt | cut ... | sed 's/|/:/'
    

    You may need to adjust the column number for the cut command, to ensure you don’t count the header.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a html file like following: <form action=/2811457/follow?gsid=3_5bce9b871484d3af90c89f37 method=post> <div> <a href=/2811457/follow?page=2&amp;gsid=3_5bce9b871484d3af90c89f37>next_page</a> &nbsp;<input
I have a sample file like the following: CREATE GLOBAL TEMPORARY TABLE tt_temp_user_11 (
I have a data file that looks like the following example. I've added '%'
I have a text file containing words separated by newline , like the following
I have several file with the following format: lat,lon,value. I would like to plot
I have a file template.txt which contains the following: Hello ${something} I would like
I have a simple assembly code file called exit.s that looks like the following:
I have an .erb file where I'd like to return the following text: Name
In my javascript file I have the following line: <div id=mygraph style=width:200px;height:100px;></div> I'd like
I have the following LINQ that I would like to also order by file

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.