File processing in Erlang
I needed a quick way to process an Erlang crashdump file.
Reaching for Erlang is natural for me so I wanted to show an example of how I approached it for a quick throw-away script.
#!/usr/bin/env escript
%%! +A0 -sname dump
%% -*- coding: utf-8 -*-
-mode('compile').
-export([main/1]).
main([CrashdumpFile]) -> ...
This is the start of an escript that will be run from the command line (let's call it dump.escript).
After making it executable (chmod 755 dump.escript), the script will be invoked with ./dump.escript path/to/erl_crash.dump and output a CSV of rows for the data we want to process (the output is being used by other, non-Erlang folks so putting it in a CSV for analysis made sense).