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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:32:09+00:00 2026-06-03T01:32:09+00:00

I am calling a webservice that’s returning a comma separated dataset with varying columns

  • 0

I am calling a webservice that’s returning a comma separated dataset with varying columns and multiple text-qualified rows (the first row denotes the column names) . I need to insert each row into a database while concatenating the rows that are varied.

The data is returned like so

"Email Address","First Name","Last Name", "State","Training","Suppression","Events","MEMBER_RATING","OPTIN_TIME","CLEAN_CAMPAIGN_ID"

"scott@example.com","Scott","Staph","NY","Campaigns and activism","Social Media","Fundraiser",1,"2012-03-08 17:17:42","Training"

There can be up to 60 columns between State and Member_Rating, and the data in those fields are to get concatenated and inserted into one database column. The first four fields and the last three fields in the list will always be the same. I’m unsure the best way to tackle this.

  • 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-03T01:32:11+00:00Added an answer on June 3, 2026 at 1:32 am

    I am not sure if this solution fits your needs. I hope so. It’s a perl script that joins with - surrounded with spaces all fields but first four and last three. It uses a non standard module, Text::CSV_XS that must be installed using CPAN or similar tool.

    Content of infile:

    "Email Address","First Name","Last Name","State","Training","Suppression","Events","MEMBER_RATING","OPTIN_TIME","CLEAN_CAMPAIGN_ID"
    "scott@example.com","Scott","Staph","NY","Campaigns and activism","Social Media","Fundraiser",1,"2012-03-08 17:17:42","Training"
    

    Content of script.pl:

    use warnings;
    use strict;
    use Text::CSV_XS;
    
    my $csv = Text::CSV_XS->new({ 
            allow_whitespace => 1,
    });
    
    open my $fh, q[<], $ARGV[0] or die qq[Open: $!\n];
    
    while ( my $row = $csv->getline( $fh ) ) {
            my $concat = join q[ - ], (@$row)[4 .. @$row-4];
            splice @$row, 4, scalar @$row - (3 + 4), $concat;
            $csv->print( \*STDOUT, $row );
            print qq[\n];
    }
    

    Run it like:

    perl script.pl infile
    

    With following output:

    "Email Address","First Name","Last Name",State,"Training - Suppression - Events",MEMBER_RATING,OPTIN_TIME,CLEAN_CAMPAIGN_ID
    scott@example.com,Scott,Staph,NY,"Campaigns and activism - Social Media - Fundraiser",1,"2012-03-08 17:17:42",Training
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm calling a webservice that is returning an unknown quantity of images in the
I am stuck in this problem, I am calling a webService that returns me
I have one ASP.NET Webservice that i calling from my Android app and getting
I am calling a webservice that generates a Excel file and when it's done
I am calling a webservice that requires client certificate authentication. If I specify a
Possible Duplicate: Calling a webservice that uses ISO-8859-1 encoding from WCF I am trying
In my ASP.net 3.5 application I'm calling an asmx webservice that is part of
Is there a simple of of calling a webService method that Rebinds an asp.Net
I have a webservice that returning 20 results each time (it is a limitation
Can you use a Spring-WS WebserviceTemplate for calling a webservice and avoid that it

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.