summary refs log tree commit diff homepage
path: root/2018/day02-1.sh
blob: 695959f0f86b76e01d9658f3c582e0c4b5293d3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
alpha='a b c d e f g h i j k l m n o p q r s t u v w x y z'
twos() {
	for a in $alpha; do
		tr -c -d "$a\n" < $1 \
			| grep -n '^..$' \
			| cut -d ':' -f 1
	done | sort -u | wc -l
}
threes() {
	for a in $alpha; do
		tr -c -d "$a\n" < $1 \
			| grep -n '^...$' \
			| cut -d ':' -f 1
	done | sort -u | wc -l
}
input=$(mktemp)
cat > $input
echo $(( $(twos $input) * $(threes $input) ))
rm $input
6029&follow=1'>Add The Calculating StarsJune McEnroe 2019-08-12Make dtch one command, add sinkingJune McEnroe 2019-08-03Add ImagoJune McEnroe 2019-07-29Add KindredJune McEnroe 2019-07-27Clean up home filesJune McEnroe 2019-07-27Fix shell script style in ~/.local/binJune McEnroe 2019-07-27Shell script style passJune McEnroe 2019-07-27Add c11.pdfJune McEnroe 2019-07-27Move pdf script to MakefileJune McEnroe 2019-07-27Update macOS neovim to 0.3.8June McEnroe 2019-07-27Rewrite port makefiles consistentlyJune McEnroe 2019-07-27Rewrite Makefile once more with more organizationJune McEnroe 2019-07-27Reference png.h in bin.7June McEnroe 2019-07-27Revert "Use scheme to style HTMLs"June McEnroe 2019-07-27Remove scheme text linkJune McEnroe 2019-07-26Update Dark.terminalJune McEnroe 2019-07-26Lighten dark whiteJune McEnroe 2019-07-25Add png.3 man pageJune McEnroe 2019-07-25Use scheme to style HTMLsJune McEnroe 2019-07-25Don't match comments in strings in makeJune McEnroe 2019-07-25Generate index.html with links from bin.7June McEnroe 2019-07-24Warn when date has changedJune McEnroe 2019-07-24Add whenJune McEnroe 2019-07-24Remove histedit from bitJune McEnroe