Skip to content

Instantly share code, notes, and snippets.

@crakaC
Created March 18, 2014 13:52
Show Gist options
  • Save crakaC/9620482 to your computer and use it in GitHub Desktop.
Save crakaC/9620482 to your computer and use it in GitHub Desktop.
ACRA(Application Crash Report for Android)を使っていて,サーバー側にたまったログからスタックトレースと機種名とAPP_VERSIONを抽出するシェルスクリプト.
#!/bin/sh
for file in `find . -name "*.txt"`; do
echo $file
begin=`grep -hn STACK_TRACE $file | cut -d ':' -f 1`
#echo $begin
blanks=`grep -hn -e "^$" $file`
for blank in $blanks; do
num=`echo $blank | cut -d ':' -f 1`
if [ $num -gt $begin ]; then
end=$num
break
fi
done
#echo $begin $end
grep -E '^(PHONE_MODEL|APP_VERSION)' $file
grep -E '^VERSION\.(RELEASE|SDK=)' $file
awk "$begin<=NR && NR<$end" $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment