Below are some random examples with a brief explanation.
Example 1 - Recursively find a string
Recursively search through all files in $ORACLE_HOME/bpel/domains/default/tmp and list out the filenames that have the hostname string "dev78.net" in them.
find $ORACLE_HOME/bpel/domains/default/tmp -type f | xargs grep "dev78.net"
Recursively search from the current directory, and replace all references of "orabpel" with "orabpel2" in all files.
find . -type f -exec sed -i "s%orabpel%orabpel2%" {} \;
In the command below, everything between the first % and the second % represents the original search string. Everything between the second % and the third % is the new string to be replaced.
find . -type f -exec sed -i "s%\(<soapEndpointURI>\)\(.*\)?wsdl\(.*\)%\1\2\.wsdl\?wsdl\3%" {} \;
(1) <soapEndpointURI>
(2) *
(the string "?wsdl" in between 2 and 3)
(3) *
So if the original string looked like this:
<soapEndpointURI>http://thisisahmed/hello?wsdl</soapEndpointURI>
<soapEndpointURI>http://thisisahmed/hello.wsdl?wsdl</soapEndpointURI>
find . -type f \( -iname "*.class" ! -iname "*.jar" ! -iname "*.zip" \) -exec sed -i "s%\(\)\(.*\)?wsdl\(.*\)%\1\2\.wsdl\?wsdl\3%" {} \;
find -type f -exec sed -i "s%\(ocation=\"http://\)\(.*\):7777\(.*\)%\1${HOSTNAME}:7777\3%" {} \;
No comments:
Post a Comment