I have this current script, that a few of you helped me get working a few weeks ago. Thanks everybody. Now I need to modify it to be a little more flexible.
BEGIN {
num = 0
while ((getline < "dc.users" > 0) {
nam[num] = $0
num++
}
}
{
for (j=0;j<num;j++) {
if ($1 ~ "^"nam[j]"$" {
$0 = substr($0, 1, length($0)-1) "-disconnected " date "\"";
flg[j] = 1
}
}
print
}
END {
for (j=0;j<num;j++) if (!flg[j]) print nam[j] > "dc.users.notfound"
}
What I need for the script to do is assign a 2nd varible like:
var_other = $1+"@domain.com"
Assuming $1 is bob
var_other should be bob@domain.com
Not sure about the about syntax or where it needs to go in the script.
Then I need the script to use the if statement to search for either variable then continue on with the script.. like:
if ($1 ~ "^"nam[j]"$" || var_other ~ "^"nam[j]"$"
Again, not sure about the syntax of above.
Any help is appreciated,
Randall
BEGIN {
num = 0
while ((getline < "dc.users" > 0) {
nam[num] = $0
num++
}
}
{
for (j=0;j<num;j++) {
if ($1 ~ "^"nam[j]"$" {
$0 = substr($0, 1, length($0)-1) "-disconnected " date "\"";
flg[j] = 1
}
}
}
END {
for (j=0;j<num;j++) if (!flg[j]) print nam[j] > "dc.users.notfound"
}
What I need for the script to do is assign a 2nd varible like:
var_other = $1+"@domain.com"
Assuming $1 is bob
var_other should be bob@domain.com
Not sure about the about syntax or where it needs to go in the script.
Then I need the script to use the if statement to search for either variable then continue on with the script.. like:
if ($1 ~ "^"nam[j]"$" || var_other ~ "^"nam[j]"$"
Again, not sure about the syntax of above.
Any help is appreciated,
Randall