Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
cat $1 | \ | ||
tr -dc [:alpha:][:space:] | \ | ||
sed -r 's/ +/\n/g' | \ | ||
grep -vE '^ *$' | \ | ||
sort | \ | ||
uniq -c | \ | ||
grep -E '^ +1 ' | \ | ||
sed -r 's/ +1 //' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
cur=$(grep -- '->' $1) | ||
while [[ $? -eq 0 ]]; do | ||
cur=${cur/ */} | ||
next=$cur | ||
cur=$(grep $cur $1 | grep -vE "^$cur") | ||
done | ||
echo $next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
max=0 | ||
declare -A vars=() | ||
eval $(cat $1 | sed -r 's/inc/+/; s/dec/-/; s/([a-z]+) ([+-]) ([-0-9]+)/vars[\1]=$((${vars[\1]-0} \2 \3)); if [[ ${vars[\1]-0} -gt $max ]]; then max=${vars[\1]}; fi/; s/^(.+) if ([a-z]+) ([!=<>]+) ([-0-9]+)/if [[ $(echo "${vars[\2]-0} \3 \4" | bc) -eq 1 ]]; then \1; fi;/') | ||
for v in "${!vars[@]}" | ||
do | ||
echo $v=${vars["$v"]} | ||
done | | ||
sort -rn -t= -k2 | head -n1 | ||
echo $max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Awful shell solutions | ||
Some days, you just want to pipe | ||
|
||
## Running | ||
The scripts take the path to the input file as first and only parameter |