#!/bin/bash echo "#pragma once" echo "" INPUT=${1:-input} COLS=$(head -n 1 "$INPUT" | wc -c) echo "namespace input {" echo " constexpr const auto COLS = $COLS;" echo " constexpr const char DATA[][COLS] = {" while IFS= read -r line; do echo " \"$line\"," done < $INPUT unset line echo " };" echo " constexpr const auto ROWS = sizeof(DATA)/sizeof(DATA[0]);" echo "}"