bash - Change the text within a file so that the text is now corresponding to the subdirectory -


i need change text within each parameter file located in each subdirectory. there 361 subdirectories.

excerpt parameter file:

pdb foldername

from: ~josh/documents/model_files/analysis/foldername

foldername needs correspond each subdirectory in parameter file located. how do 361 subdirectories using shell in terminal? (i not familiar batch , of stuff.)

something that:

find . -mindepth 2 -name "*" -exec sh -c 'sed -i "s,pbd foldername,pbd $(echo $(basename $(dirname {})))," {}' \; 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -