Skip to content

Instantly share code, notes, and snippets.

@livibetter
Created July 15, 2017 13:53
Show Gist options
  • Save livibetter/8e34b38a8f6b41c28cda6ff2b89737a4 to your computer and use it in GitHub Desktop.
Save livibetter/8e34b38a8f6b41c28cda6ff2b89737a4 to your computer and use it in GitHub Desktop.
sed delimiter
#!/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