Skip to content

Instantly share code, notes, and snippets.

@Ajnasz

Ajnasz/mystery-solver.sh

Last active Mar 13, 2018
Embed
What would you like to do?
#!/bin/sh
# get clues
grep CLUE crimescene
# clue mentioned Annabel
grep Annabel people | \
cut -s -f 4 | \
cut -d ' ' -f1-2,4 | \
sed 's/ /_/' | \
sed 's/,//' | \
while read line;do
# n the streets file you can find a SEE INTERVIEW line
head -n `echo $line | cut -d' ' -f2` `echo streets/$line | cut -d' ' -f1` | tail -n 1 | sed 's/SEE INTERVIEW #//';
done | \
while read line;do
cat interviews/interview-$line;
done;
# Annabel were talking about a Blue Honda
# Other clue mentioned about a guy who is at least 6' tall
grep 'Honda' vehicles -A 4 -B 1 | grep 'Color: Blue' -B 2 -A 4 | \
grep 'L337.*9' -A 5 | grep 'Height: 6' -A 1 -B 5 | grep 'Owner' | cut -d ' ' -f2- | \
while read user;do
# Clue talking about membership, suspect must be member of all of the 4 groups
if [ "`grep "$user" memberships/AAA memberships/Museum_of_Bash_History memberships/Delta_SkyMiles memberships/Terminal_City_Library | wc -l`" -eq 4 ]; then
grep "$user" people;
fi;
done | \
# The guy has to be male
while read line;do
if [ "`echo $line | cut -d ' ' -f3`" = "M" ];then
echo $line | cut -d ' ' -f1,2
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment