편하게 살자

awk 꼼수 - 001 - 특정 필드 뽑아내기

mulderu 2013. 11. 6. 09:42

아래는 springmvc project 의 controller loading 로그중 mapping path 부분입니다.

개인적으로 mapping path만 발취하려고 합니다.

server$ head aa
AbstractHandlerMethodMapping.java[registerHandlerMethod]:179 - Mapped "{[/acl],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.yudo.imc.controller.AclController.main(org.springframework.ui.Model)
AbstractHandlerMethodMapping.java[registerHandlerMethod]:179 - Mapped "{[/acl/aclRole],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.yudo.imc.controller.AclController.aclRole(org.springframework.ui.Model)
AbstractHandlerMethodMapping.java[registerHandlerMethod]:179 - Mapped "{[/acl/aclRoleMember],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.yudo.imc.controller.AclController.aclRoleMember(org.springframework.ui.Model)
AbstractHandlerMethodMapping.java[registerHandlerMethod]:179 - Mapped "{[/acl/aclResource],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.yudo.imc.controller.AclController.aclResource(org.springframework.ui.Model)
AbstractHandlerMethodMapping.java[registerHandlerMethod]:179 - Mapped "{[/acl/aclInfo],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.yudo.imc.controller.AclController.aclInfo(org.springframework.ui.Model)
AbstractHandlerMethodMapping.java[registerHandlerMethod]:179 - Mapped "{[/acl/api/search/{nameKey}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List> com.yudo.imc.controller.AclController.searchAcl(java.lang.String,com.yudo.imc.domain.AclDomains) throws java.lang.Exception
........................
server$ 

위파일내역에서 mapping url 만 단순 무식하게 뽑아내기..

cat aa | awk  '{print $4}' | awk 'BEGIN {FS="["}; {print $2}' | awk 'BEGIN {FS="]"}; {print $1}'