Last active
May 20, 2016 09:25
-
-
Save hackugyo/ff0ba61dad1317b7d87f2a41a696a7a1 to your computer and use it in GitHub Desktop.
SlackのログからURL取得以外のものを抜き出す。jq, ruby必須
This file contains hidden or 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 | |
# 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 |
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
Ctrl-Cですっきり終わるようにした。
$sh extract_slack_any_lines_but_urls.sh "amazon"