Skip to content

Instantly share code, notes, and snippets.

@rhowe
Created December 8, 2019 10:59
Show Gist options
  • Save rhowe/acb5a63e3a2361b58ee238804649a218 to your computer and use it in GitHub Desktop.
Save rhowe/acb5a63e3a2361b58ee238804649a218 to your computer and use it in GitHub Desktop.
AOC2019day8part2
#!/bin/bash
set -eu
set -o pipefail
input=$1
width=$2
height=$3
cd "$(dirname "$0")"
rm -rf tmp
mkdir tmp
cd tmp
split -b "$((width * height))" "../$1"
sed -i 's/./&\n/g' *
paste -d '' *|sed -e 's/^2*\(.\).*/\1/' |xargs -n "$width" |tr -d \ | tr 0 ' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment