Hi everybody!
it's great to be here since this is my first post.
touch /base/oracle/FRA/XMUT00/RMAN_FLAG
touch /base/oracle/FRA/XRLL00/RMAN_FLAG
find directory name containing RMAN_FLAG :
$ find /base/oracle/FRA -name RMAN_FLAG -print|xargs -n1 dirname |sort -u
/base/oracle/FRA/XMUT00
/base/oracle/FRA/XRLL00
find all file named *.arc :
$ find /base/oracle/FRA -name "*.arc" -print
/base/oracle/FRA/XARS00/XARS00arch6563.arc
/base/oracle/FRA/XARS00/XARS00arch6562.arc
/base/oracle/FRA/XARS00/XARS00arch6559.arc
/base/oracle/FRA/XARS00/XARS00arch6560.arc
/base/oracle/FRA/XARS00/XARS00arch6561.arc
/base/oracle/FRA/XBIO00/XBIO00arch286.arc
/base/oracle/FRA/XMUT00/XMUT00arch3624.arc
/base/oracle/FRA/XMUT00/XMUT00arch3616.arc
/base/oracle/FRA/XMUT00/XMUT00arch3613.arc
/base/oracle/FRA/XMUT00/XMUT00arch3621.arc
/base/oracle/FRA/XMUT00/XMUT00arch3626.arc
/base/oracle/FRA/XRLL00/XRLL00arch5199.arc
/base/oracle/FRA/XRLL00/XRLL00arch5200.arc
/base/oracle/FRA/XRLL00/XRLL00arch5201.arc
/base/oracle/FRA/XRLL00/XRLL00arch5202.arc
I want to remove all *.arc files execpt those found in directories where RMAN_FLAG is present
I tried :
EXCLU=$(find /base/oracle/FRA -name RMAN_FLAG -print|xargs -n1 dirname |sort -u)
for file in $(find /base/oracle/FRA -name "*.arc" -print|
grep -v ${EXCLU})
do
rm $file
done
but grep does not work with multiple values (I know perl grep function accept a list of values but shell grep don't
)
any hints? using sed and/or maybe awk?
I'm on HPUX standard grep/awk/sed (not gnu)
thanks