Created
July 15, 2017 13:53
-
-
Save livibetter/8e34b38a8f6b41c28cda6ff2b89737a4 to your computer and use it in GitHub Desktop.
sed delimiter
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
#!/bin/bash | |
# https://www.reddit.com/r/commandline/comments/6nb76h/lpt_use_hashpoundnumbersignoctothorpe_as_a_sed/dk8hanv/ | |
DICT=/usr/share/dict/words | |
main() | |
{ | |
SALL=($(egrep '^s(\w).*\1.*\1$' "$DICT")) | |
for sub in "${SALL[@]}"; do | |
diff --side-by-side --suppress-common-lines <(sed "$sub" "$DICT") "$DICT" | | |
while read result bar word; do | |
grep -q "^$result\$" "$DICT" || continue | |
echo -e "$ echo $word | sed $sub\n$result" | |
done | |
date +%s | |
done | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment