..

Sed one-liner to convert CSV files to properties files

Read a CSV file and convert it to strings file using sed (stream editor):

sed -e 1d -e 's/,/ = /' -e 's/$/;/' data.csv > data.strings

Sample CSV:

KEY,LANGUAGE
keyname1,"Nononono “%{placeholder}”?"
keyname2,"Nononon %{placeholder} nononon."
keyname3,"Open in %{placeholder}?"
keyname4,GB
keyname5,TB

Output:

keyname1 = "Nononono “%{placeholder}”?";
keyname2 = "Nononon %{placeholder} nononon.";
keyname3 = "Open in %{placeholder}?";
keyname4 = GB;
keyname5 = TB;

sed(1) Mac OS X Manual Page