Advertisement
tike

unixLab7Q5

Nov 3rd, 2015
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.47 KB | None | 0 0
  1. BEGIN{ 
  2.  
  3.     "who | wc -l" | getline whoLineCount
  4.    
  5.     for(i ; i < whoLineCount; i = i + 1){
  6.         "who" | getline whoData
  7.         split(whoData,resultWho," ")
  8.        
  9.         "grep -e" resultWho[1] " /etc/passwd" | getline passwdGrep
  10.         split(passwdGrep, resultPassw, ":")
  11.  
  12.         array[resultWho[1]] = array[resultWho[1]] + 1
  13.  
  14.         result[resultWho[1]] = " Name : " resultWho[1] ", User dir : "  resultPassw[6]  ", Nb co : " array[resultWho[1]]
  15.        
  16.     }
  17.     for(i in result){
  18.         print result[i]
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement