awk and execute

Hi All,

I need this to execute and not just print on Red Hat ent 4 bash shell.

cat /etc/passwd|grep db2 | awk -F":" '{print "cat /etc/group | grep ",$4}'

Output:

cat /etc/group | grep 1000 (I don't want this to print but execute)

Thanks for any comment you may add.

Use system() function

awk -F":" '/db2/{system("grep "$4" /etc/group")}' /etc/passwd

Thanks but how come it's multiplying by 2 (or more, depending on how many members).

But this will fix it: awk -F":" '/db2:/{system("grep "$4" /etc/group")}' /etc/passwd