Formulas and one-liners

In order to take a spreadsheet full of data in the format First Name, Last Name, Birthdate and transform it into a flat text file in the format unix_name:birthdate, I used an Excel formula and a short UNIX one-liner.  The Excel formula to make the unix_name from First Name, Last Name colums is =SUBSTITUTE(LOWER(CONCATENATE(LEFT(A2,1),B2)), " ", ""). The UNIX one-liner to get just the last two columns of the csv document and convert them into colon-delimited is cut -d',' -f3,4 /export/home/homelan/tmp/Members_20111207_192645.csv | sed s/,/:/g.

Advertisements

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: