Brincando com comandos find, while, dirname e truques do bash

find /opt/p255/ -type f -iwholename "*var*" -name "*.fs" -printf '%h %f\n'|while read a b; do A=/tmp; B=$(awk -F/ '{print $4"/"$5}' <<< ${a}); C=${b%.fs}; echo mkdir -pv ${A}/${B}/${C}; echo /opt/p255/${B}/bin/repozo -BFvzf ${a}/${b} -r ${A}/${B}/${C}; done



Resultado:
mkdir -pv /tmp/zeocluster2/server/saf_projetos_BD
/opt/p255/zeocluster2/server/bin/repozo -BFvzf /opt/p255/zeocluster2/server/var/saf_projetos_BD.fs -r /tmp/zeocluster2/server/saf_projetos_BD

mkdir -pv /tmp/zeocluster2/server/dirti_cgti_BD
/opt/p255/zeocluster2/server/bin/repozo -BFvzf /opt/p255/zeocluster2/server/var/dirti_cgti_BD.fs -r /tmp/zeocluster2/server/dirti_cgti_BD


find /opt/p255/ -type f -iwholename "*var*" -name "*.fs" -printf '%h %f\n'|while read a b; do echo $a; echo ${a#/opt/p255}; echo ${a%/var}; dirname $a; dirname ${a#/opt/p255}; echo $b; echo ; done
Resultado:
/opt/p255/zeocluster2/server/var #echo $a
/zeocluster2/server/var          #echo ${a#/opt/p255}
/opt/p255/zeocluster2/server     #echo ${a%/var}
/opt/p255/zeocluster2/server     #dirname $a
/zeocluster2/server              #dirname ${a#/opt/p255}
projetos_BD.fs                   #echo $b

/opt/p255/zeocluster2/server/var
/zeocluster2/server/var
/opt/p255/zeocluster2/server
/opt/p255/zeocluster2/server
/zeocluster2/server
cgti_BD.fs


find /opt/p255/ -type f -iwholename "*var*" -name "*.fs" -printf '%h %f\n'|while read a b; do echo $a; echo ${a#/opt/p255}; echo ${a%/var}; dirname $a; dirname ${a#/opt/p255}; echo $b; echo `dirname ${a#/opt/p255}`/${b%.fs}; echo ---; done
Resultado:
/opt/p255/zeocluster2/server/var
/zeocluster2/server/var
/opt/p255/zeocluster2/server
/opt/p255/zeocluster2/server
/zeocluster2/server
projetos_BD.fs
/zeocluster2/server/projetos_BD
---
/opt/p255/zeocluster2/server/var
/zeocluster2/server/var
/opt/p255/zeocluster2/server
/opt/p255/zeocluster2/server
/zeocluster2/server
cgti_BD.fs
/zeocluster2/server/cgti_BD
---

find /opt/p255/ -type f -iwholename "*var*" -name "*.fs" -printf '%h %f\n'|while read a b; do echo $a; echo ${a#/opt/p255}; echo ${a%/var}; dirname $a; dirname ${a#/opt/p255}; echo $b; A=/BKP`dirname ${a#/opt/p255}`/${b%.fs}; echo ---; echo mkdir -pv $A; echo $REPOZO -BFvzf $a/$b -r $A; done

/opt/p255/zeocluster2/server/var
/zeocluster2/server/var
/opt/p255/zeocluster2/server
/opt/p255/zeocluster2/server
/zeocluster2/server
projetos_BD.fs
---
mkdir -pv /BKP/zeocluster2/server/projetos_BD
/opt/p255/bin/repozo.py -BFvzf /opt/p255/zeocluster2/server/var/projetos_BD.fs -r /BKP/zeocluster2/server/projetos_BD
---
/opt/p255/zeocluster2/server/var
/zeocluster2/server/var
/opt/p255/zeocluster2/server
/opt/p255/zeocluster2/server
/zeocluster2/server
cgti_BD.fs
---
mkdir -pv /BKP/zeocluster2/server/cgti_BD
/opt/p255/bin/repozo.py -BFvzf /opt/p255/zeocluster2/server/var/cgti_BD.fs -r /BKP/zeocluster2/server/cgti_BD
---

Comentários