What is Awk?

Awk is a weird mix of command-line tool and programming language. It's a language specifically designed for text processing. By default it has a notion of rows and separators. Think CSV but without support for quoted separators.


Fastlane is a tool for automating iOS app development. Among other things it allows you to automate submission of App Store details such as screenshots and descriptions. Why is this necessary? because if your app is localized into 20-odd languages then you have to enter this information 20 times. And when you decide to update the description you have to do it again. And if you haven't used iTunes Connect Appstore Connect before you need to know that each page-load takes ~45s.

Gross, thank god for Fastlane.

Except, an impasse. Your localization team has all the information nicely orngaized into a spread sheet like the following.

But Fastlane wants the information in separate folders for each language like so:

Copying this text manually is tedious and error-prone. But as you might have guessed, we can solve this with Awk.


First, export the spreadsheet into a delimited text file. This can be done with your typical CSV export feature. Pipes are a simple delimiter which usually don't show up in real-world data.

Your file looks like this:

en-US | Your favorite app
es-ES | Tu aplicación favorita
fr-FR | Votre application préférée
de-DE | Ihre Lieblings-App
cat subtitles.txt | awk -F " [|] " \
out_file=$1 "/subtitle.txt";
system("mkdir " $1);
print $2 > out_file

- F " [|] " tells awk to use a space followed by a pipe followed by a space as the separator (the default is a tab character).

The rest of the awk program is run for each line in the input file.

  • First we define a variable out_file to contain the string {language_abbreviation}/subtitle.txt. Awk has a shortcut for the columns in a row. So $1 corresponds to en-US in the first row.
  • Next we create a directory with the langauge localization (this already existed in our use-case, but this may be necessary). system runs a command as if at a terminal. We create a en-US folder for the first line.
  • Finally we place the localization in a file at out_file.


Of course this could have been done in any number of langauges. Bash and Python are two alternatives that comes to mind, but bash is annoying and python feels a little too clunky for this kind of thing in my opinion.