Participate in Codex, Test Your Skills & Win BIG

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


Assume that input has the following content:

Lotty,Kilner,08 Boyd Place,Jiangqiao,04,,433-447-7966
Benoite,Ducket,9 Harper Alley,Tenenkou,22,,724-995-7769

Your script should output the following:

Lotty,Kilner,08 Boyd Place,Jiangqiao,,+04-433-447-7966
Benoite,Ducket,9 Harper Alley,Tenenkou,,+22-724-995-7769


  • 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
  • Hint 1
  • Solution Approach
  • Complete Solution


Click here to start solving coding interview questions