enthuguy
asked on
How to check a string and get a substring in bash
hi experts.
pls help
Sample input file:
[changed] parent_dir/app_name/comp_n ame/proces s/ccc/sca_ aws.approv al.test.up datecriter ia_rev1.0. jar ( size 144280 : 144280 )
[changed] parent_dir/app_name/comp_n ame/ui/xxx /aws.workf low.ui.loa ns.ear/aws .cz.ui.tem plate.mar ( size 2644 : 2644 )
[changed] parent_dir/app_name/comp_n ame/proces s/xxx/sca_ aws.cz_rev 1.0.jar/xs l/aws.xsl ( size 9440 : 9464 )
[changed] parent_dir/app_name/comp_n ame/proces s/xxxx.zip /sca_aws.a pproval.te st.maintai n_rev1.0.j ar ( size 143643 : 143643 )
[changed] parent_dir/app_name/comp_n ame/ui/ggg gg/aws.wor kflow.ear/ aws.cz.ui. view.accou nt.mar ( size 12904 : 12904 )
[changed] sharedResources.jar/proces s/xsd/me/t est.xsd ( size 3001 : 2947 )
[changed] aws.workflow.ui.test.war/W EB-INF/cla sses/com/a pp_name/ui /test/even t/test.cla ss ( size 3426 : 4364 )
output trying to achive:
process=sca_aws.approval.t est.update criteria_r ev1.0.jar, sca_aws.cz _rev1.0.ja r,sca_aws. approval.t est.mainta in_rev1.0. jar
ui=aws.workflow.ui.loans.e ar,aws.wor kflow.ear
war=aws.workflow.ui.test.w ar
As you can see,
if I find a string "process" then I have to get the jar name
if I find a string "ui" then ear name
same for war
I would request, if you could help with individual script for each expression. eg. process, ui, war
thanks in advance
pls help
Sample input file:
[changed] parent_dir/app_name/comp_n
[changed] parent_dir/app_name/comp_n
[changed] parent_dir/app_name/comp_n
[changed] parent_dir/app_name/comp_n
[changed] parent_dir/app_name/comp_n
[changed] sharedResources.jar/proces
[changed] aws.workflow.ui.test.war/W
output trying to achive:
process=sca_aws.approval.t
ui=aws.workflow.ui.loans.e
war=aws.workflow.ui.test.w
As you can see,
if I find a string "process" then I have to get the jar name
if I find a string "ui" then ear name
same for war
I would request, if you could help with individual script for each expression. eg. process, ui, war
thanks in advance
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER