grep 笔记

-a :将 binary 文件以 text 文件的方式搜寻数据
-c :计算找到 '搜寻字符串' 的次数
-i :忽略大小写的不同,所以大小写视为相同
-n :顺便输出行号
-v :反向选择,亦即显示出没有 '搜寻字符串' 内容的那一行!
--color=auto :可以将找到的关键词部分加上颜色的显示喔!
-r
-w 全子匹配
-E 使用egrep功能,多字匹配

grep -E? ?'aaaaa|bbbbbb'

grep -E 'SIGNAL|OFL Hit'


logcat -s MiSysSrv MiMwIptvSrv MiMwTvosSrv

logcat -c;logcat  -v time -s  ld-linux.so.3 MiSysSrv | grep -v 'mi_display_GetSourceType|mi_atom_display_GetSourceType'

logcat -c;logcat  -v time -s  ld-linux.so.3 MiSysSrv | grep -v '<<<mi_'


-v time -s  ld-linux.so.3 | grep -E 'u32Brightness|sharpness_t'

grep -E? ?'aaaaa|bbbbbb'

grep -nriE 'SVCMGR|APMLIB' ok.txt

logcat -c;logcat | grep -v 'tvos|RootActivity|TvManager_JNI'

logcat -c;logcat | grep -v 'tvos' | grep -v 'RootActivity' | grep -v 'TvManager_JNI'


--color


如果类似于含有”test、auto_load”之类的文件我也不显示,怎么做呢?我之前的做法是:
grep -r "UserService" ./ | grep -v "svn\|prj\|test\|auto_load"

http://www.cnblogs.com/chenwenbiao/archive/2011/10/11/2206870.html

WATCHDOG kill

grep -nriE 'coredump' *


grep -nriE 'MiSysSrv|ServiceManager|MiMwIptvSrv' [69]_AC_console_otto.huang_20170214-110209.log
grep -nriE 'MiSysSrv|ServiceManager|MiMwIptvSrv' [81]_AC_console_otto.huang_20170207-165002.log

grep -nriE 'kill|died|coredump' [81]_AC_console_otto.huang_20170207-165002.log

I/ServiceManager( 1199): service 'mstar.miSi' died


grep -nrE 'sn init-chk#6|AC_ON|Launching|Enter SetVideoMute|Unmute' *


grep -nriE 'kill|died|coredump' *

grep -nriE 'ServiceManager|AudioSystem|MiSysSrv|MiMwIptvSrv|AudioManager|Waiting for' log.txt

grep -nriE 'AudioSystem|MiMwIptvSrv|AudioManager|Waiting for' log.txt

 

grep -nriE 'kill|died|coredump|MiSysSrv' str*


grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal' *

grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|MiSysSrv|bootvideo' *


grep -nriE 'start ub|finish boot' *

grep -nriE 'MStar STR waiting power off...|MStar STR Resuming...|A N D R O I D' *

grep -nriEa 'AC_Off|AC_On|logcat|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|finish boot|Boot animation finish|SurfaceFlinger' *


grep -nriEa 'A N D R O I D|Boot animation finish' *

 

grep -nr AC_Off
AC_On
logcat


grep -nriE 'MiSysSrv|bootvideo' *

find -name '*.h' | xargs grep -nr pt_regs


AC

logcat -s AndroidRuntime Process

logcat -c;logcat | grep -nrE 'StatusBar|AndroidRuntime|Process'

grep -nriE 'fail|MiSysSrv|anr|watchdog|fatal|' *

#######################
grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG' *


logcat -c;logcat |

grep -nrE 'WindowManager|dispatchKeyEvent' *

grep -nrE '1337|1184|1173' log.txt

 

grep -nrE 'A N D R O I D |PowerManagerService|LightsHAL|MiSysSrv|MStar STR Resuming...|MStar STR waiting power off|PowerHAL|ShutdownThread' a.log

grep -nrE 'A N D R O I D |PowerManagerService|LightsHAL|MStar STR Resuming...|MStar STR waiting power off|PowerHAL|ShutdownThread' b.log

 

grep -nrE 'MyDialog|interceptKeyTi' 0915-7.log


PowerManagerService

LightsHAL

MiSysSrv


grep -nriE 'dispatchKeyEventdied|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...' *

grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!' * | grep -v Debug | grep -v debug

lowmemorykiller: Killing
#######################
grep -anriE 'PowerOn|PowerManager|Starting kernel|Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|AndroidRuntime|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR' * |
grep -v Debug | grep -v debug  |
grep -anriE 'PowerOn|PowerManager|Starting kernel|Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|AndroidRuntime|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR'
#######################
grep -anriE 'PowerOn|PowerManager|Starting kernel|Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR' * |
grep -v Debug | grep -v debug  |
grep -anriE 'PowerOn|PowerManager|Starting kernel|Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR'
#######################
grep -anriE 'Starting kernel|Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR' * |
grep -v Debug | grep -v debug  |
grep -anriE 'Starting kernel|Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR'

 

grep -anriE 'Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|AndroidRuntime|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR' * |
grep -v Debug | grep -v debug  |
grep -anriE 'Power Down|ShutdownThread|LightsHAL|Watchdog|interceptKeyTi|dispatchKeyEvent|PowerManagerService|FATAL|AndroidRuntime|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|lowmemorykiller: Killing|held by |ANR'
#######################
#######################
grep -anriE 'dispatchKeyEvent|PowerManagerService|FATAL|AndroidRuntime|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR' * |
grep -v Debug | grep -v debug  |
grep -anriE 'dispatchKeyEvent|PowerManagerService|FATAL|AndroidRuntime|Process :|died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR'
#######################
grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR' 0622650.log |
grep -v Debug | grep -v debug  |
grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR'


grep -anriE 'died|coredump|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR' |
grep -v Debug | grep -v debug  |
grep -anriE 'died|coredump|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR'

 

grep -anriE 'died|coredump|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR' * |
grep -v Debug | grep -v debug  |
grep -anriE 'died|coredump|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR'


grep -anriE 'BOEOT|COREDUMP|MiSysSrv' *

 

grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|held by |ANR' * |
grep -v Debug | grep -v debug |
grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|A N D R O I D|MStar STR Resuming...|MStar STR waiting power off|is Null\, please connect!|held by |ANR'

 


 grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...'
#######################
grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR' * |
grep -v Debug | grep -v debug  |
grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller|held by |ANR'
KILL
PowerManagerService
#######################


grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|held by ' *

 

grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller|held by|MiMwIptvSrv' * |
grep -v Debug | grep -v debug  |
grep -anriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller|held by|MiMwIptvSrv'

######################
grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller|ActivityManager' * |
grep -v Debug | grep -v debug  |
grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller|ActivityManager'
#######################

grep -v  'MiSysSrv' * | grep -v 'audio_hw_primary'

grep -v  'MiSysSrv' c2p.txt | grep -v 'audio_hw_primary'


grep -v  'MiSysSrv' log-last.txt | grep -v 'audio_hw_primary'
|
grep -v  'MiSysSrv' log-720.txt | grep -v 'audio_hw_primary'

grep -nriE 'MiSysSrv' *

grep -nirE 'ActivityManager|SystemServer|InputManager|pcapcmcc|KILL|Input   :' b.txt

grep -v  'MiSysSrv'

grep -v  'MiSysSrv' huawei.log | grep -v 'Kernel' > a.txt

grep -v  'MiSysSrv' huawei-1.log | grep -v 'Kernel' > b.txt

grep -v  'HRCS' a.txt b.txt > c.txt


grep -v  'MiSysSrv' a.txt

grep -v  'Kernel' *

 | grep -v 'audio_hw_primary'

grep -v  'MiSysSrv' huawei.log | grep -v 'Kernel' > a.txt


grep -nr "MStar STR waiting power off..." *

#######################

 

grep -nriE '[MsOS_Init]|MsOS_SHM_Init|Hello ZC|MiSysSrv' *

grep -nriE '\[MsOS_Init\]|MsOS_SHM_Init|Hello ZC|MApi_AUTH_Process|MDrv_AUTH_IPCheck' start_1.log

 

grep -v  'MiSysSrv' * | grep -v 'Kernel' | grep -v  '[MMP]' | grep -v audio_hw_primary

grep -v  '[MMP]' * | grep -v audio_hw_primary | grep -v Downloader

 


MsOS_SHM_Init should


[MsOS_Init]

 

A N D R O I D

 

grep -v  'MiSysSrv' log.txt | grep -v 'apiMMAP' | grep -v MiMwIptvSrv | grep -v Resources | grep -v utopia | grep -v android


grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|MiSysSrv' *


grep -nriE 'died|coredump|dump_backtrace|assert|fatal|backtrace|signal|A N D R O I D|MStar STR Resuming...' COM26-662.log 


grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!' * | grep -v Debug | grep -v debug --color=auto

export XXX="died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect\!|oom_adj|lowmemorykiller"
grep -nriE '$XXX'

grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller' * |
grep -v Debug | grep -v debug  |
grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!|oom_adj|lowmemorykiller'

grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!' *

 

grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MiSysSrv|MiMwIptvSrv' *


grep -nriE 'died|c' *

grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|A N D R O I D|MStar STR Resuming...' 041911.log


grep -v  'StreamDataSource' 041201.log.126 | grep -v 'MMP' | grep -v 'mstplayer' | grep -v 'MiSysSrv'


grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|A N D R O I D|MStar STR Resuming...' 041901m.log


grep -v  '[MMP]' * | grep -v audio_hw_primary | grep -v Downloader


grep -nriE 'MStar STR Resuming...|2083|ActivityManager|4344' *


grep -v  'MiSysSrv' 041901m.log | grep -v 'MMP' | grep -v 'mstplayer'


grep -nriE 'SurfaceFlinger|finish boot|ActivityManager|PackageManager' c.log

grep -nriE 'SurfaceFlinger|finish boot' c.log

 

grep -v 'MMP'


grep -v  'MiSysSrv' * | grep -v 'D/'

grep -v 'D/' * | grep -v 'V/' | grep -v 'I/' | grep -v 'E/' | grep -v 'W/'
'
grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|MiSysSrv|MiMwIptvSrv' *  | grep -v '\[INFO\]'

 

grep -nriE 'died|coredump|terminated|dump_backtrace|assert|fatal|backtrace|signal|DEBUG|A N D R O I D|MStar STR Resuming...|is Null\, please connect!' 426.log

 

grep -nrE 'DEBUG' 041911.log


logcat -c;logcat | grep -v 'MiSysSrv'

grep -nriE 'System.err' *


grep -nriE 'fail|MiSysSrv|anr|watchdog|fatal|System.err' *

 

grep -nriE 'mediaplayer' *

posted @ 2017-11-21 20:10  天空中的弧线  阅读(1811)  评论(0编辑  收藏  举报