Question
Asked by:
vineethredz
vineethredz from univeristy of tulsa
Rating : No Rating
Questions Asked: 1
Tutorials Posted: 0
 

$50.00 need help to find out the command

Q:
Unix questions:-

1)Develop an awk program to summarize from the list of all processes a count of processes run by every user(including root).

2)Find out the next available UID in /etc/passwd after ignoring all system users placed at the beginning and up to occurrence of the user nobody?

3)Create an awk script that prints the last field of every line (note that lines may have different numbers of fields). (Hint: use an appropriate global varaible).
 
Want to take a stab at the bounty and post a tutorial? Need clarification? Join us now or log in! Read more on how this works.
 
Available Tutorials to this Question
Posted by:
b_h
b_h from U. in B.
Rating (488): A+
Questions Asked: 0
Tutorials Posted: 912, earned $16,356.96
 

$50.00 Help with awk

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on Oct. 31, 2008 at 10:34:50AM
A:
Preview: ... so initialize a counter, i, and a skip variable. The counter is going to help us keep track of where to store the data we're reading. The skip variable is going to let us skip lines until we see the nobody user. Once we see the nobody user we start parsing. Once we start parsing, we simply grab the UID from the 3rd field and then stash it at the end of an array and increment he position of the end of the array
<pre>
BEGIN { FS = ":" ; i = 1; skip = 1 }

# skip comment lines
/^#/ { next }
# if skip is still set, see if we're processing the nobody line. If we are, then skip this line but process the following lines
skip == 1 { if ($1 == "nobody") skip = 0; next }
# if we're not skippi ...

The full tutorial is about 1026 words long .
Posted by:
nvrmore100
nvrmore100 from Axia College
Rating : No Rating
Questions Asked: 0
Tutorials Posted: 6, earned $0.00
 

$30.00 Answers to each of the items

  • This tutorial hasn't been purchased yet.
  • Posted on Nov 18, 2008 at 6:23:48PM
A:
Preview: ... 0;
MAX=0;
}

{

if (NOBODY==1) {
if ($3 > MAX){
MAX=$3;
}
}

if ($1 == &q ...

The full tutorial is about 133 words long .
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty