Âncoras não funcionam com grep

1

Estou tentando fazer um grep estendido nos registros do Android. No entanto, eu não sou capaz de combinar as âncoras para isso.

Aqui está minha consulta -

grep -A 25 -E 'show\(authenticated = |onAllPanelsCollapsed\(\)|makeExpandedInvisible$'

Eu quero combinar

  • show(authenticated = ou
  • onAllPanelsCollapsed() ou
  • makeExpandedInvisible no final da linha .

No entanto, a saída que estou sempre obtendo é

D/KeyguardBouncer(  855): show(authenticated = false) is called.
D/KeyguardBouncer(  855): show(authenticated = false) is called.
W/System.err(  855): java.lang.Throwable: stack dump
W/System.err(  855):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  855):    at com.android.systemui.statusbar.phone.KeyguardBouncer.show(KeyguardBouncer.java:91)
W/System.err(  855):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.showBouncer(StatusBarKeyguardViewManager.java:134)
W/System.err(  855):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:334)
W/System.err(  855):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:326)
W/System.err(  855):    at com.android.systemui.statusbar.phone.PhoneStatusBar.showBouncer(PhoneStatusBar.java:3888)
W/System.err(  855):    at com.android.systemui.statusbar.phone.PhoneStatusBar.makeExpandedInvisible(PhoneStatusBar.java:2564)
W/System.err(  855):    at com.android.systemui.statusbar.phone.PhoneStatusBarView$1.run(PhoneStatusBarView.java:121)
W/System.err(  855):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
W/System.err(  855):    at android.view.Choreographer.doCallbacks(Choreographer.java:598)

Embora eu esteja usando um extended grep , não consigo corresponder a makeExpandedInvisible , mas os outros padrões estão funcionando bem.

EDITAR

Correspondência para -

 grep -A 25 -E 'show\(authenticated = |onAllPanelsCollapsed\(\)|makeExpandedInvisible'

é

D/KeyguardBouncer(  850): show(authenticated = false) is called.
D/KeyguardBouncer(  850): show(authenticated = false) is called.
W/System.err(  850): java.lang.Throwable: stack dump
W/System.err(  850):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  850):    at com.android.systemui.statusbar.phone.KeyguardBouncer.show(KeyguardBouncer.java:91)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.showBouncer(StatusBarKeyguardViewManager.java:134)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:334)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:326)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.showBouncer(PhoneStatusBar.java:3888)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.onTrackingStopped(PhoneStatusBar.java:3953)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView.onTrackingStopped(PhoneStatusBarView.java:164)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.onTrackingStopped(PanelView.java:373)
W/System.err(  850):    at com.android.systemui.statusbar.phone.NotificationPanelView.onTrackingStopped(NotificationPanelView.java:1492)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.onTouchEvent(PanelView.java:340)
W/System.err(  850):    at com.android.systemui.statusbar.phone.NotificationPanelView.onTouchEvent(NotificationPanelView.java:649)
W/System.err(  850):    at android.view.View.dispatchTouchEvent(View.java:8486)
W/System.err(  850):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2535)
W/System.err(  850):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2220)
W/System.err(  850):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2541)
W/System.err(  850):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2234)
W/System.err(  850):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2541)
W/System.err(  850):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2234)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarWindowView.dispatchTouchEvent(StatusBarWindowView.java:175)
W/System.err(  850):    at android.view.View.dispatchPointerEvent(View.java:8687)
W/System.err(  850):    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4485)
W/System.err(  850):    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4343)
W/System.err(  850):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3884)
--
I/PhoneStatusBarView(  850): onAllPanelsCollapsed()
W/System.err(  850): java.lang.Throwable: stack dump
W/System.err(  850):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView.onAllPanelsCollapsed(PhoneStatusBarView.java:116)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelBar.panelExpansionChanged(PanelBar.java:191)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView.panelExpansionChanged(PhoneStatusBarView.java:180)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.notifyBarPanelExpansionChanged(PanelView.java:898)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.setExpandedHeightInternal(PanelView.java:639)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView$10.onAnimationUpdate(PanelView.java:891)
W/System.err(  850):    at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1283)
W/System.err(  850):    at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1207)
W/System.err(  850):    at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1248)
W/System.err(  850):    at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:659)
W/System.err(  850):    at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:682)
W/System.err(  850):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
W/System.err(  850):    at android.view.Choreographer.doCallbacks(Choreographer.java:598)
W/System.err(  850):    at android.view.Choreographer.doFrame(Choreographer.java:566)
W/System.err(  850):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
W/System.err(  850):    at android.os.Handler.handleCallback(Handler.java:810)
W/System.err(  850):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  850):    at android.os.Looper.loop(Looper.java:189)
W/System.err(  850):    at android.app.ActivityThread.main(ActivityThread.java:5532)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(  850):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
W/System.err(  850):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
--
I/PhoneStatusBar(  850): makeExpandedInvisible
W/System.err(  850): java.lang.Throwable: stack dump
W/System.err(  850):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.makeExpandedInvisible(PhoneStatusBar.java:2528)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView$1.run(PhoneStatusBarView.java:121)
W/System.err(  850):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
W/System.err(  850):    at android.view.Choreographer.doCallbacks(Choreographer.java:598)
W/System.err(  850):    at android.view.Choreographer.doFrame(Choreographer.java:566)
W/System.err(  850):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
W/System.err(  850):    at android.os.Handler.handleCallback(Handler.java:810)
W/System.err(  850):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  850):    at android.os.Looper.loop(Looper.java:189)
W/System.err(  850):    at android.app.ActivityThread.main(ActivityThread.java:5532)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(  850):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
W/System.err(  850):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
I/PanelView(  850): setExpandedHeight(): height: 0.0
I/PanelView(  850): setExpandedHeightInternal(): height: 0.0
D/PanelBar(  850): panelExpansionChanged: start state=0 panel=null
W/System.err(  850): java.lang.Throwable: stack dump
W/System.err(  850):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelBar.panelExpansionChanged(PanelBar.java:164)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView.panelExpansionChanged(PhoneStatusBarView.java:180)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.notifyBarPanelExpansionChanged(PanelView.java:898)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.setExpandedHeightInternal(PanelView.java:639)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.setExpandedHeight(PanelView.java:588)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.setExpandedFraction(PanelView.java:665)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelBar.collapseAllPanels(PanelBar.java:209)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.makeExpandedInvisible(PhoneStatusBar.java:2534)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView$1.run(PhoneStatusBarView.java:121)
W/System.err(  850):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
W/System.err(  850):    at android.view.Choreographer.doCallbacks(Choreographer.java:598)
W/System.err(  850):    at android.view.Choreographer.doFrame(Choreographer.java:566)
W/System.err(  850):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
W/System.err(  850):    at android.os.Handler.handleCallback(Handler.java:810)
W/System.err(  850):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  850):    at android.os.Looper.loop(Looper.java:189)
W/System.err(  850):    at android.app.ActivityThread.main(ActivityThread.java:5532)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(  850):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
W/System.err(  850):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
D/PanelBar(  850): panelExpansionChanged: end state=0 [ fullyClosed ]
D/PanelBar(  850): panelExpansionChanged: start state=0 panel=null
W/System.err(  850): java.lang.Throwable: stack dump
W/System.err(  850):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelBar.panelExpansionChanged(PanelBar.java:164)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView.panelExpansionChanged(PhoneStatusBarView.java:180)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.notifyBarPanelExpansionChanged(PanelView.java:898)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelView.cancelPeek(PanelView.java:748)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PanelBar.collapseAllPanels(PanelBar.java:211)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.makeExpandedInvisible(PhoneStatusBar.java:2534)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView$1.run(PhoneStatusBarView.java:121)
W/System.err(  850):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
W/System.err(  850):    at android.view.Choreographer.doCallbacks(Choreographer.java:598)
W/System.err(  850):    at android.view.Choreographer.doFrame(Choreographer.java:566)
W/System.err(  850):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
W/System.err(  850):    at android.os.Handler.handleCallback(Handler.java:810)
W/System.err(  850):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  850):    at android.os.Looper.loop(Looper.java:189)
W/System.err(  850):    at android.app.ActivityThread.main(ActivityThread.java:5532)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(  850):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
W/System.err(  850):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
D/PanelBar(  850): panelExpansionChanged: end state=0 [ fullyClosed ]
D/StatusBarKeyguardViewManager(  850): dismiss(authenticated = false) is called. mScreenOn = true
D/KeyguardBouncer(  850): show(authenticated = false) is called.
D/KeyguardBouncer(  850): show(authenticated = false) is called.
W/System.err(  850): java.lang.Throwable: stack dump
W/System.err(  850):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  850):    at com.android.systemui.statusbar.phone.KeyguardBouncer.show(KeyguardBouncer.java:91)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.showBouncer(StatusBarKeyguardViewManager.java:134)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:334)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:326)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.showBouncer(PhoneStatusBar.java:3888)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.makeExpandedInvisible(PhoneStatusBar.java:2564)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView$1.run(PhoneStatusBarView.java:121)
W/System.err(  850):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
W/System.err(  850):    at android.view.Choreographer.doCallbacks(Choreographer.java:598)
W/System.err(  850):    at android.view.Choreographer.doFrame(Choreographer.java:566)
W/System.err(  850):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
W/System.err(  850):    at android.os.Handler.handleCallback(Handler.java:810)
W/System.err(  850):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  850):    at android.os.Looper.loop(Looper.java:189)
W/System.err(  850):    at android.app.ActivityThread.main(ActivityThread.java:5532)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(  850):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
W/System.err(  850):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
D/KeyguardViewBase(  850): show()
D/KeyguardViewBase(  850): KeyguardViewBase.show()
W/System.err(  850): java.lang.Throwable: stack dump
W/System.err(  850):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(  850):    at com.android.keyguard.KeyguardViewBase.show(KeyguardViewBase.java:131)
W/System.err(  850):    at com.android.systemui.statusbar.phone.KeyguardBouncer.show(KeyguardBouncer.java:97)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.showBouncer(StatusBarKeyguardViewManager.java:134)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:334)
W/System.err(  850):    at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.dismiss(StatusBarKeyguardViewManager.java:326)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.showBouncer(PhoneStatusBar.java:3888)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBar.makeExpandedInvisible(PhoneStatusBar.java:2564)
W/System.err(  850):    at com.android.systemui.statusbar.phone.PhoneStatusBarView$1.run(PhoneStatusBarView.java:121)
W/System.err(  850):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
W/System.err(  850):    at android.view.Choreographer.doCallbacks(Choreographer.java:598)
W/System.err(  850):    at android.view.Choreographer.doFrame(Choreographer.java:566)
W/System.err(  850):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
W/System.err(  850):    at android.os.Handler.handleCallback(Handler.java:810)
W/System.err(  850):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  850):    at android.os.Looper.loop(Looper.java:189)
W/System.err(  850):    at android.app.ActivityThread.main(ActivityThread.java:5532)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(  850):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(  850):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
W/System.err(  850):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
D/KeyguardSecurityModel(  850): isPinPukOrMeRequiredOfSubId() - simState = ABSENT
D/KeyguardSecurityModel(  850): isPinPukOrMeRequiredOfSubId() - simState = ABSENT
D/AntiTheftManager(  850): getCurrentAntiTheftMode() is called.
D/KeyguardSecurityModel(  850): getSecurityMode() - PW_Quality = 65536
D/LockPatternUtilsCache(  850): havePattern() - cache = true
D/LockPatternUtils(  850): s=true ,L=true ,q=true ,v=false
D/LockPatternUtilsCache(  850): havePattern() - cache = true
V/KeyguardSecurityContainer(  850): showPrimarySecurityScreen(turningOff=false)
D/KeyguardSecurityContainer(  850): showSecurityScreen(Pattern)
D/KeyguardSecurityModel(  850): isPinPukOrMeRequiredOfSubId() - simState = ABSENT
D/KeyguardSecurityModel(  850): isPinPukOrMeRequiredOfSubId() - simState = ABSENT
D/AntiTheftManager(  850): getCurrentAntiTheftMode() is called.

Como você pode ver, há várias correspondências para makeExpandedInvisible , mas quero a correspondência para a linha que contém apenas

I/PhoneStatusBar(  850): makeExpandedInvisible

i.e. makeExpandedInvisible no final da linha e NÃO as outras linhas contendo makeExpandedInvisible .

A consulta -

grep -A 25 -E 'show\(authenticated = |onAllPanelsCollapsed\(\)|makeExpandedInvisible$'

não funciona.

Mesmo o -A 25 não é um problema. Os logs são ainda maiores, incluí apenas uma parte.

    
por yadav_vi 16.04.2015 / 16:48

1 resposta

1

Use todos os padrões dentro de um grupo:

grep -A 25 -E '(show\(authenticated = |onAllPanelsCollapsed\(\)|makeExpandedInvisible)$'

Como agrupamos os padrões usando () , eles serão tratados como um todo e isso corresponderá a qualquer um dos três padrões no final da linha.

Anteriormente, no seu comando grep -A 25 -E 'show\(authenticated = |onAllPanelsCollapsed\(\)|makeExpandedInvisible$' , ele estava tratando três padrões individualmente, ou seja, show\(authenticated = e onAllPanelsCollapsed\(\) em qualquer lugar da linha e makeExpandedInvisible apenas no final da linha.

Como resultado, estava correspondendo show\(authenticated = em qualquer lugar OU onAllPanelsCollapsed\(\) em qualquer lugar OU makeExpandedInvisible no final da linha.

    
por 16.04.2015 / 17:01

Tags