Link to home
Start Free TrialLog in
Avatar of enthuguy
enthuguyFlag for Australia

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_name/process/ccc/sca_aws.approval.test.updatecriteria_rev1.0.jar  ( size 144280 : 144280 )
[changed] parent_dir/app_name/comp_name/ui/xxx/aws.workflow.ui.loans.ear/aws.cz.ui.template.mar  ( size 2644 : 2644 )
[changed] parent_dir/app_name/comp_name/process/xxx/sca_aws.cz_rev1.0.jar/xsl/aws.xsl  ( size 9440 : 9464 )
[changed] parent_dir/app_name/comp_name/process/xxxx.zip/sca_aws.approval.test.maintain_rev1.0.jar  ( size 143643 : 143643 )
[changed] parent_dir/app_name/comp_name/ui/ggggg/aws.workflow.ear/aws.cz.ui.view.account.mar  ( size 12904 : 12904 )
[changed] sharedResources.jar/process/xsd/me/test.xsd  ( size 3001 : 2947 )
[changed] aws.workflow.ui.test.war/WEB-INF/classes/com/app_name/ui/test/event/test.class  ( size 3426 : 4364 )

output trying to achive:
process=sca_aws.approval.test.updatecriteria_rev1.0.jar,sca_aws.cz_rev1.0.jar,sca_aws.approval.test.maintain_rev1.0.jar
ui=aws.workflow.ui.loans.ear,aws.workflow.ear
war=aws.workflow.ui.test.war

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
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enthuguy

ASKER

Thanks very much!