The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
zip utility on HP-UX jgutierrez29 UNIX for Dummies Questions & Answers 1 06-22-2005 03:10 PM
AWK utility malaymaru UNIX for Dummies Questions & Answers 3 05-05-2005 01:27 AM
Sed utility malaymaru UNIX for Dummies Questions & Answers 4 05-04-2005 03:37 AM
BRU utility sherbet808 UNIX Desktop for Dummies Questions & Answers 7 06-20-2003 10:22 AM
sar utility srinivasp UNIX for Advanced & Expert Users 2 11-15-2002 11:31 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-19-2001
dilipluhar dilipluhar is offline
Registered User
  
 

Join Date: Jun 2001
Location: Singapore
Posts: 3
Cool awk utility

Can you give me specific examples of
usage of awk utility.
  #2 (permalink)  
Old 06-19-2001
alwayslearningunix
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
This sounds like a homework question to me

So I will give a general answer in that awk is mainly used to search input, whether it be from a file or command run at the command line, for a specific pattern or patterns and then perform an action on that pattern.

For example, if you wanted to regularly kill a process in a script, but are not sure the PID of that process at any one moment in time, awk is good to search for that pattern and send the PID to the kill command thus:

kill -9 `ps -ef | grep $process | grep -v grep | awk '{print $1}'`

This is a very simply application of a relatively powerful and flexible language.

Search on the web for more on specific examples relating to awk.

Regards.
  #3 (permalink)  
Old 06-19-2001
alwayslearningunix
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
p.s you may need to modify the $ statement to print in the awk command to suit it to your system (most systems will list the username under the first column which is $1, and then the PID under second column which is $2 etc)

Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0