Transform CSV

Given a csv file(with , as a delimiter) named input with the following fields:

  • FirstName
  • LastName
  • Address
  • City
  • CountryCode
  • Email
  • PhoneNumber

Write a bash script to combine both CountryCode and PhoneNumber with a - and add a + before country code and remove country codes from the csv file

Example:

Assume that input has the following content:

Lotty,Kilner,08 Boyd Place,Jiangqiao,04,lkilner0@epa.gov,433-447-7966
Benoite,Ducket,9 Harper Alley,Tenenkou,22,bducket1@friendfeed.com,724-995-7769

Your script should output the following:

Lotty,Kilner,08 Boyd Place,Jiangqiao,lkilner0@epa.gov,+04-433-447-7966
Benoite,Ducket,9 Harper Alley,Tenenkou,bducket1@friendfeed.com,+22-724-995-7769

Note:

  • Note that the given csv file does not contain headers i.e., only data is present.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Transform CSV on Interview Code Editor
Sign Up
to access hints and editorial solutions for Transform CSV

Discussion


Loading...
Click here to start solving coding interview questions