Using sed

Hi,

cat /tmp/out2.lst | xargs -i dirname {}|sed -e "s/${SOURCE_DB_SID}/${TARGET_DB_SID}/"|\
sed "s/$SOURCE_DATA_DEST/$TARGET_DATA_DEST/g"|sort -u|
while read line
...
...
done

The above existing code works Ok. However if substitution in sed didn't occur this must to be an exception I need to know. Is there any way to find it out

Thank you

Hi,

I am not sure how to capute the result of sed that whether it has subsitute any match.

But i think you can change your logic to below:

1> grep : to check whether contain the content you want to substitue
2> if $? for grep is 0 then use sed to subsitute it
if not, skip

Seems this is the common logic.

Thank you. Agree. I will change the logic a little.