how to get only .json file names in string array to iterate over filename
Problem: I have 12 .json files at path /side/containers_automation/sc/2021-05/ This path can have different file extensions as well.
find /side/containers_automation/sc/2021-05 -type f -name "*.json"
/side/containers_automation/sc/2021-05/ci-userstory-tlm.json
/side/containers_automation/sc/2021-05/ci-userstory-spe.json
/side/containers_automation/sc/2021-05/ci-e2e-tlm.json
/side/containers_automation/sc/2021-05/ci-userstory-dm-inbound.json
/side/containers_automation/sc/2021-05/cucumber-ci-e2e-ta-dm.json
/side/containers_automation/sc/2021-05/cucumber-ci-e2e-tlm.json
/side/containers_automation/sc/2021-05/bvt-dm.json
/side/containers_automation/sc/2021-05/ci-userstory-dm-outbound-execution.json
/side/containers_automation/sc/2021-05/ci-e2e-dm.json
/side/containers_automation/sc/2021-05/cucumber-ci-userstory-tlm.json
/side/containers_automation/sc/2021-05/ci-userstory-dm-outbound.json
/side/containers_automation/sc/2021-05/uat-dm.json
want to copy just filenames of type .json and append a keyword (ex: automation) before these. ex: automation-ci-userstory-tlm automation-cucumber-ci-e2e-ta-dm automation-uat-dm etc. and store these names in a string array so that i can iterate over this.
I am new to shell scripting. Would need your help on this. Thank you. My thought ->
Get file names by command
(find /side/containers_automation/sc/2021-05 -type f -name "*.json" > conf_search)
trim initial path (
/side/containers_automation/sc/2021-05) and file format (.json)
/side/containers_automation/sc/2021-05/uat-dm.json 3. just get uat , ci-userstory-tlm, ci-userstory-tlm , put this in string array 4. iterate over this I know it is complex and lengthy solution.