Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
valid=0
while read line
do
min=$(echo $line | cut -d ' ' -f 1 | cut -d '-' -f 1)
max=$(echo $line | cut -d ' ' -f 1 | cut -d '-' -f 2)
char=$(echo $line | cut -d ' ' -f 2 | sed 's/://')
pass=$(echo $line | cut -d ' ' -f 3)
count=$(echo $pass | grep -o $char | wc -l)
if [ $count -ge $min -a $count -le $max ]
then
valid=$(($valid + 1))
fi
done <<< $(< $1)
echo $valid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment