Last active
February 4, 2021 16:42
-
-
Save neverunlucky/2f478f2eab5767ee7f3b6694cfd9868b to your computer and use it in GitHub Desktop.
idevicesyslog target filter shell script
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 | |
#name: idevicesyslog target filter shell script | |
#author: SerKo <https://github.com/serkoape> | |
#usage: idevicesyslog | ./idsl-filter.sh "<target name>" | |
#idevicesyslog | ./idsl-filter.sh "SpringBoard" | |
#idevicesyslog | ./idsl-filter.sh "SpringBoard(Custom.dylib)" | |
#idevicesyslog | sudo sh ./idsl-filter.sh "SpringBoard(Custom.dylib)" | |
IFS='' # fix for tab space | |
IS_PRINT=false | |
REGEX_ISLOG="^[A-Z][a-z]{2} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Za-z0-9\-]{1,} (.*)\[[0-9]*\]" | |
while read log; do | |
if [[ $log =~ $REGEX_ISLOG ]]; then | |
if [[ "${BASH_REMATCH[1]}" == *"$1"* ]]; then IS_PRINT=true; else IS_PRINT=false; fi | |
fi | |
if $IS_PRINT; then printf "$log\n"; fi # use "${log//\^\[\[/\e[}\n"; if HBLog color cannot show in terminal | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment