Skip to content

Instantly share code, notes, and snippets.

@neverunlucky
Last active February 4, 2021 16:42
Show Gist options
  • Save neverunlucky/2f478f2eab5767ee7f3b6694cfd9868b to your computer and use it in GitHub Desktop.
Save neverunlucky/2f478f2eab5767ee7f3b6694cfd9868b to your computer and use it in GitHub Desktop.
idevicesyslog target filter shell script
#!/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