1. How to use child commands with find ?
     find . -name classes -exec rm -r -f {} \ ;
     Please note there is a blank between {} and \;
 
2. How to use grep ?
     grep [options] PATTERN [FILES]
 
     Recursively search
     grep -r string_pattern *
 
3. How to use locate to find file?
     updatedb
     locate **/*.xml
 
4. How to find which jar constians the specified file?
     find . -name '*.jar' -exec unzip -l {} \; | grep 'Access.java \|Archive:'
     find . -name '*.jar' -exec unzip -l {} \; | grep 'Access.java\|Archive:' | sed 's#\(.*Access.java.*\)#\x1b[1;31m\1\x1b[1;37m#'
 
5.How to replace the text in a file?
     sed -in-place -e 's/are/were/g' test.txt
 
6. How to replace the text in a folder?
    find . -name "*.txt" -exec sed -in-place -e 's/are/were/g' {} \;
 
7. \ is the escape char.So if you want to replace C:\Windows with D:\Windows
    sed -in-place -e 's/C:\/windows/D:\/Widnows/g' test.txt
 
Reference
 
http://www.linuxsir.org/main/?q=node/137
http://blog.youkuaiyun.com/chaiqi/archive/2007/03/05/1521276.aspx