Awk scripting Question
Smith, Albert
Albert.Smith at genexservices.com
Thu Mar 3 00:09:00 UTC 2005
How about this:
for x in `cat /tmp/users`
do
grep $x /etc/passwd|cut -d":" -f6 >>/tmp/home_dir
done
Albert Smith
Sr. Unix Systems Administrator
HPCSA, RHCT
Genex Services
440 E. Swedesford Rd.
Wayne, PA 19087
albert.smith at genexservices.com
(610) 964-5154
> -----Original Message-----
> From: redhat-list-bounces at redhat.com
> [mailto:redhat-list-bounces at redhat.com] On Behalf Of Simran H.
> Sent: Wednesday, March 02, 2005 7:01 PM
> To: redhat-list at redhat.com
> Subject: Awk scripting Question
>
> 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.
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
>
More information about the redhat-list
mailing list