Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

Using awk in UNIX & Linux

Oracle Tips by Burleson Consulting

 

Also see handy awk command examples.

Using awk in UNIX

The awk utility is especially useful for removing a specific column of output from a UNIX command. For example, suppose we need to create a list of UNIX process ID’s for all Oracle processes on our server.

root> ps -ef|grep -i oracle|awk '{ print $2 }'
23308
25167
12193
25163
12155
24065
24073


Here we start by issuing the ps –ef command to get a list of all UNIX processes, and then use grep to filter out all processes except this that contain the string “oracle.

Finally, we use the awk utility to extract the second column of output.

root> ps -ef|grep -i oracle
oracle 23308 1 0 May 14 ? 0:06 ora_lgwr_prodb1
oracle 25167 1 0 Apr 30 ? 0:26 ora_smon_prodc1
oracle 25163 1 0 Apr 30 ? 41:27 ora_lgwr_prodc1
oracle 12155 1 0 11:30:43 ? 0:01 oracleprodcars (LOCAL=NO)
oracle 24065 1 0 Apr 30 ? 0:02 ora_pmon_rman
oracle 24073 1 0 Apr 30 ? 10:39 ora_ckpt_rman
oracle 24846 1 0 May 11 ? 0:48 oracleprodc1 (LOCAL=NO)

root> ps -ef|grep -i oracle|awk '{ print $2 }'

23308
25167
12193
25163
12155
24065
24073

The awk  utility is used often extract a specific column of data from output or a file.  For example, to create a list of UNIX process IDs for all Oracle processes on the server.

 

root> ps -ef|grep -i oracle|awk '{ print $2 }'

23308
25167
12193
25163
12155
24065
24073

 

First, issue the ps  –ef  command to get a list of all UNIX processes, and then use grep to filter out all processes except this that contain the string “oracle.”  The awk  utility is used to extract the second column of output.

 

root> ps -ef|grep -i oracle

  oracle 23308     1  0   May 14 ?        0:06 ora_lgwr_prodb1
  oracle 25167     1  0   Apr 30 ?        0:26 ora_smon_prodc1
  oracle 25163     1  0   Apr 30 ?       41:27 ora_lgwr_prodc1
  oracle 12155     1  0 11:30:43 ?        0:01 oracleprodcars (LOCAL=NO)
  oracle 24065     1  0   Apr 30 ?        0:02 ora_pmon_rman
  oracle 24073     1  0   Apr 30 ?       10:39 ora_ckpt_rman
  oracle 24846     1  0   May 11 ?        0:48 oracleprodc1 (LOCAL=NO)

root> ps -ef|grep -i oracle|awk '{ print $2 }'

23308
25167
12193
25163
12155
24065
24073

 



 

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.