Reading from file...
i want to read from a file and for every word to do a command.. I use a for loop inside awk for reading all the words inside the file.. Then i want to use grep, but it's a problem because the exit of awk are many results and not one..
for example if file has: aaaa bbbb cccc dddd eeee i want to execute: grep aaaa, grep bbbb...e.t.c Any idea?? |
Quote:
Code:
egrep "aaaa|bbbb" file |
Basicly, what i want to do is: i have a file (users.txt) that has the words like this:
aaa bbb ccc ddd eee... i want the script to take each word and do a command.. I used the command awk to read each word from the file...But then?? |
You don't need to use awk for this. You could simply use:
for user in $(cat users.txt); do ... done |
Have you considered the who command?
Also, look at the system() function built in to gawk. |
Quote:
|
Read info who and note the discussion re utmp and wtmp.
|
Quote:
Code:
who | awk 'BEGIN { |
All times are GMT -5. The time now is 07:48 AM. |