[oracle@DB-Server admin]$ grep -w "ORA" utlspadv.sql -- ORA-XXXXX: Monitoring already started. If for example you want -- ORA-20111: -- ORA-20112: -- ORA-20113: 'no active monitoring job found' -- ORA-20113: 'no active monitoring job found' -- ORA-20111: -- ORA-20112: -- ORA-20100: -- ORA-20113: 'no active monitoring job found' -- ORA-20113: 'no active monitoring job found' [oracle@DB-Server admin]$ grep "ORA" utlspadv.sql -- ORA-XXXXX: Monitoring already started. If for example you want -- ORA-20111: -- ORA-20112: -- ORA-20113: 'no active monitoring job found' -- ORA-20113: 'no active monitoring job found' -- 0 |<PS> =>DBS2.REGRESS.RDBMS.DEV.US.ORACLE.COM 0 0 2 99.3% 0% 0.7% "" -- |<PR> DBS1.REGRESS.RDBMS.DEV.US.ORACLE.COM=> 100% 0% 0% "" |<PR> ... -- =>DBS2.REGRESS.RDBMS.DEV.US.ORACLE.COM 92 7 99.3% 0% 0.7% "" |<PR> ... -- |<C> CAPTURE_USER1=>DBS2.REGRESS.RDBMS.DEV.US.ORACLE.COM 2 0 0 0.E+00 -- |<C> CAPTURE_USER1=>DBS2.REGRESS.RDBMS.DEV.US.ORACLE.COM -- ORA-20111: -- ORA-20112: -- ORA-20100: -- ORA-20113: 'no active monitoring job found' -- ORA-20113: 'no active monitoring job found' [oracle@DB-Server admin]$
10: grep命令结合find命令搜索
[oracle@DB-Server admin]$ find . -name '*.sql' -exec grep -i 'v\$temp_space_header' {} \; -print create or replace view v_$temp_space_header as select * from v$temp_space_header; create or replace public synonym v$temp_space_header for v_$temp_space_header; create or replace view gv_$temp_space_header as select * from gv$temp_space_header; create or replace public synonym gv$temp_space_header FROM gv$temp_space_header ./catspace.sql drop public synonym v$temp_space_header; drop public synonym gv$temp_space_header; ./catspacd.sql [oracle@DB-Server admin]$
11: egrep -w -R 'word1|word2' ~/klbtmp
12: vi命令其实也能搜索文件里面的内容,只不过没有grep命令功能那么方便、强大。
Linux下Shell编程——grep命令的基本运用