I googled for several hours and could not find a solution for the following issue (at least I did not find one I could understand and adapt).
My cwd is:
/home/ubuntu/data/modelling/Iamvariable/Var1/PRODUCTION/ANALYSIS/Var2/DIHEDRALS
and I need to extrakt the "text" behind Var1
and Var2
.
I would like to scan the pwd output from right to left since the file path starting could change but the path starting after Iamvaribale
will stay always the same. By means of number of elements in path and except Iamvaribale
(and of course Var1
and Var2
) also the folder names will stay the same.
How can I achieve this in a bash sricpt?
Var1 =
Var2 =
edit:
/home/ubuntu/data/modelling/Iamvariable/Var1/PRODUCTION/ANALYSIS/Var2/DIHEDRALS
basically everything in capital letters is fixed. If there is no easy solution where
/home/ubuntu/data/modelling
is not fixed this is OK to be set as fixed. But it would be better to have it not fixed, to have it more flexible.