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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:45:05+00:00 2026-05-18T21:45:05+00:00

I have a csv file that contains a location field. I need to import

  • 0

I have a csv file that contains a “location” field. I need to import this field into Drupal with node import, but I have to import the address field into different fields. One for “postal code”, another for “street” etc.

The “location” field contains the whole address with a ‘|’ delimiter in between – like this: “street street no | postal code city”

How would I best change the csv file before I import it? I only have experience with php, and I don’t know much about perl or python scripts, but I have a hunch that it would be best to write a script that can parse the csv file and change the “location” field into new fields.

Is that about right? I would be grateful for some suggestions as to where I should start – thanks a lot

  • 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-05-18T21:45:06+00:00Added an answer on May 18, 2026 at 9:45 pm

    You don’t give an example line. You might have trouble if you don’t know Perl.
    In general, there are good Csv modules on CPAN, this may be needed to discerne embedded
    field delimeter char(s) within the field itself. Otherwise, read in the file line by line,
    modify the line then write it out to a new file. Something like this (untested) ..

    use strict;
    use warnings;
    
    open my $infile,  '<', 'filein.csv'  or die "error opening infile $!";
    open my $outfile, '>', 'fileout.csv' or die "error opening outfile $!";
    
    while (<$infile>) {
       my @fields = split /,|\|/, $_;
       print $outfile join(',', @fields), "\n";
    }
    close $outfile;
    close $infile;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have a CSV file that contains rows like this Jacop , Assistant,150,75
I have a function that automatically exports a table into a CSV file, then
I have a file that contains the following in a csv file; country,region,city,postalCode,metroCode,areaCode I
I have a Testing project that contains a csv file which a webtest uses
So I have a CSV that contains a filename and a file's contents. The
I have a .bin file that contains records in CSV format what I want
I have a large CSV file that contains independent items that take a fair
I have a .csv file that is frequently updated (about 20 to 30 times
I have a CSV file that holds about 200,000 - 300,000 records. Most of
I have a CSV data file with rows that may have lots of columns

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.