Please refer to these examples:
Find the key word "ProcessType=6" in text files under current path (included sub folder)
> find ./ -name "*.txt" -exec grep -n -H "ProcessType=6" {} \;
Replace the key word "python2.4" with "python2.6" in python files under /opt/stack (included sub folder)
> find /opt/stack -name "*.py" -exec sed -i 's/python2.4/python2.6/' '{}' \;
Based on the script above, you will be able to find or replace a key word quickly and efficiently.
No comments:
Post a Comment