How would I get folders owned by specific users.. I want to pass users as a shell variable to awk.
drwxr-x--x 3 user1 allusers 512 Oct 14 2006 946157019/
drwxr-x--x 3 user2 allusers 512 Mar 9 2008 94825883/
drwxr-x--x 3 user3 allusers 512 Mar 9 2008 948390501/
For some reason when I pass search expression as argument, its not working. But when I replace $var1 with hardcoded string it works..
$>ls -lt | /usr/xpg4/bin/awk -v var1='user1|user2' '$3 ~ /"'$var1'"/'
How do we pass pattern as argument to awk?
Same approach works if its awk's statement.