Awk scripting Question

linux-OvvuX/[email protected] Wed, 2 Mar 2005 15:57:11 -0800 (PST)
Newsgroups gmane.linux.admin.managers
Message-ID <[email protected]>
Hey Guys,

I am trying to do some cleanup work on one of my linux systems and am
having problems with a script that I am writing.. Hopefully someone here
can help me out:

ls /home_nfs >> /tmp/users
foreach user(`cat /tmp/users`)
        (echo `grep '/$user:' /home/Home_Script/passwd` | awk -F : '{print
$6}' | awk -F / '{print "/"$2"/"$3}' >> /tmp/home_dir)
end

It looks like the script is failing at the echo `grep '/$user:'
/home/Home_Script/passwd` part.. Anyone know what I am doing wrong.

What I am trying to achieve is this:

I have a file /tmp/users with all usernames and I want to grep for those
users names in /etc/passwd and create another directory with just the home
dir entries.

Any help would be grately appreciated.

Thanks in advance.
_______________________________________________
LinuxManagers mailing list - http://www.linuxmanagers.org
submissions: LinuxManagers-35TzE1X9F6582KRnZfj+bdi2O/[email protected]
subscribe/unsubscribe: http://www.linuxmanagers.org/mailman/listinfo/linuxmanagers