パターン内で文字列を検索するコマンド

パターン内で文字列を検索するコマンド

ログファイルの内容は次のとおりです。

Caused by: com.ofss.fc.framework.exception.BusinessException: The memo start date cannot be earlier than the process date.
at com.ofss.fc.domain.party.service.core.CommentService.validateMemos(CommentService.java:474)
at com.ofss.fc.lz.us.appx.party.service.core.ext.RegionalPartyAddressApplicationServiceSpiExt.preUpdatePartyAddress(RegionalPartyAddressApplicationServiceSpiExt.java:43)
at com.ofss.fc.appx.party.service.core.ext.PartyAddressApplicationServiceSpiExtExecutor.preUpdatePartyAddress(PartyAddressApplicationServiceSpiExtExecutor.java:82)
at com.ofss.fc.appx.party.service.core.PartyAddressApplicationServiceSpi.updatePartyAddress(PartyAddressApplicationServiceSpi.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Caused by: com.ofss.fc.framework.exception.BusinessException: The memo start date cannot be earlier than the process date.
at com.ofss.fc.domain.party.service.core.CommentService.validateMemos(TestService.java:474)
at com.ofss.fc.lz.us.appx.party.service.core.ext.RegionalPartyAddressApplicationServiceSpiExt.preUpdatePartyAddress(RegionalPartyAddressApplicationServiceSpiExt.java:43)
at com.ofss.fc.appx.party.service.core.ext.PartyAddressApplicationServiceSpiExtExecutor.preUpdatePartyAddress(PartyAddressApplicationServiceSpiExtExecutor.java:82)
at com.ofss.fc.appx.party.service.core.PartyAddressApplicationServiceSpi.updatePartyAddress(PartyAddressApplicationServiceSpi.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Caused次の行をキャッチしようとしています

bash-4.1$ a=$(awk '/Caused/{getline; print}' testError.log )
bash-4.1$ echo $a

出力:

com.ofss.fc.domain.party.service.core.CommentService.validateMemos(CommentService.java:474) at com.ofss.fc.domain.party.service.core.CommentService.validateMemos(TestService.java:474)

()内のすべてのファイル名をリストする必要があります。

リストの出力は次のようになります。

CommentService.java
TestService.java

ベストアンサー1

そしてsed

$ sed -n '/Caused/{
  N
  s/.*\n[^(]*(//
  s/:[^:]*$//
  p
}' <file

おすすめ記事