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 8759569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:50:16+00:00 2026-06-13T14:50:16+00:00

I have a file containing lines like insert into table_name (params1,params2,params3) values (43044,’x’,23547003); insert

  • 0

I have a file containing lines like

insert into table_name    (params1,params2,params3)  values (43044,'x',23547003);
insert into table_name    (params1,params2,params3)  values (43024,'y',26557003);
.....

I want to remove the first column/value pair. i.e. this is the desired output.

insert into table_name    (params2,params3)  values ('x',23547003); 
insert into table_name    (params2,params3)  values ('y',26557003);

How can I do this?

here is what I did till now

cat file_name | sed 's/params1,//g' 

This removes the params1 but how do I remove the number after values?

Tl;dr

change from insert into table_name (params2,params3) values (43024,'y',26557003); to insert into table_name (params2,params3) values ('y',26557003);

  • 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-13T14:50:17+00:00Added an answer on June 13, 2026 at 2:50 pm

    You can use:

    sed -e 's/params1,//' -e 's/values ([^,]*,/values (/'
    

    as per the following transcript:

    pax> cat infile
    insert into table_name    (params1,params2,params3)  values (43044,'x',23547003);
    insert into table_name    (params1,params2,params3)  values (43024,'y',26557003);
    
    pax> sed -e 's/params1,//' -e 's/values ([^,]*,/values (/' infile
    insert into table_name    (params2,params3)  values (x,23547003);
    insert into table_name    (params2,params3)  values (y,26557003);
    

    The first sed argument you already have. The second simply finds the first string made up of:

    • the string "values (";
    • zero or more non-comma characters (greedy match, as many as possible); and
    • a comma.

    Then it replaces that with "values (" which effectively gets rid of the first argument of the values.

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

Sidebar

Related Questions

I have a file containing 100000 lines like this 1 0110100010010101 2 1000010010111001 3
I have a file containing a certain number of lines. Each line looks like
I have a file containing some lines of code followed by a string pattern.
Suppose I have a file containing some lines: line 1 ... line 2 ...
I have an HTML file containing these lines - <script>PrintFileURL("13572_BranchInformationReport_2012-06-29.xml","13572_BranchInformationReport_2012-06-29.zip",0,"184277","Jun 29 1:30","/icons/default.gif")</script> <script>PrintFileURL("13572_BranchInformationReport_2012-07-02.zip","13572_BranchInformationReport_2012-07-02.zip",0,"184302","Jul 2
I have a text file containing two or more types of lines. I would
I have a txt file that created in notepad , containing these lines for
I have to filter a text file filter.tmp containing two types of lines, this
I have a CSV file containing some user data it looks like this: 10333,,an.10,Kenyata,,Aaron,,,,,,,,,,
I have an XML file containing seed data that I'm trying to load into

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.