In this recipe, we will make use of the pipe operator (
|>) to create a series of transformations in a text file.
|> operator feeds the result of the left-hand side expression as the first argument of the right-hand side expression. It is possible to create complex transformations on data, giving the programmer a more immediate perception of the data flow.
We will parse a text file, make all characters uppercase, replace every vowel with
@, and save it as a new file.
We will create a Mix project and escriptize it to allow us to run it from the command line without having to start an IEx session. The steps are as follows:
> mix new pipe_transformation