Skip to content

Instantly share code, notes, and snippets.

@hackugyo
Last active May 20, 2016 09:25
Show Gist options
  • Save hackugyo/ff0ba61dad1317b7d87f2a41a696a7a1 to your computer and use it in GitHub Desktop.
Save hackugyo/ff0ba61dad1317b7d87f2a41a696a7a1 to your computer and use it in GitHub Desktop.
SlackのログからURL取得以外のものを抜き出す。jq, ruby必須
#!/bin/bash
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT
function ctrl_c() {
echo "** Trapped CTRL-C"
exit
}
file=*.json
for TXT in ${file}
do
cat $TXT |
jq '.[].text | select(match("^[^\"<http]"))' |
ruby -ne '$_.split("\\n").each{|a| puts a}' # xargs -I {} echo -e {}では実現できなかった
done
@hackugyo
Copy link
Author

hackugyo commented May 20, 2016

sh extract_slack_any_lines_but_urls.sh "978" | sed -e 's/^.*\([0-9]\{13\}\).*$/\1/g' | LC_ALL=C sort | uniq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment