Reputation: 21
I have a following script,
#!/bin/ksh
#***********************************************************
echo "Enter Local Drive path LOCALPATH:"
read LOCALPATH
echo "Enter NA R Drive NAPATH:"
read NAPATH![enter image description here][1]
find ./ -type f | xargs sed -i "s|$LOCALPATH|$NAPATH|g" Run.param
#
which is working fine in a single directory & changing the contents of Run.param file
Upvotes: 2
Views: 157
Reputation: 5281
assuming you are asking about the directory NAPATH:
change
find ./ -type f | xargs sed -i "s|$LOCALPATH|$NAPATH|g" Run.param
to
OUTER = $NAPATH/..
for d in $OUTER/*; do
find ./ -type f | xargs sed -i "s|$LOCALPATH|$d|g" Run.param
done
if Run.param is located in NAPATH, use:
OUTER = $NAPATH/..
for d in $OUTER/*; do
find ./ -type f | xargs sed -i "s|$LOCALPATH|$d|g" $NAPATH/Run.param
done
Upvotes: 1