[ale] Read multiple variables

Ed Cashin ecashin at noserose.net
Thu Sep 12 12:25:49 EDT 2013


I bet you know already, but for completeness I guess it's worth mentioning
that awk can do it all, from the grep part to the while loop.

[ecashin at herlihy ~]$ awk -vuser=ecashin -F: '$1==user{print "U is " $1 ", G
is " $4 ", and it\x27s " $5}' /etc/passwd
U is ecashin, G is 1000, and it's Ed Cashin
[ecashin at herlihy ~]$



On Thu, Sep 12, 2013 at 8:35 AM, leam hall <leamhall at gmail.com> wrote:

> Well, I used to know how to do this. Trying to get multiple variables set
> in one line:
>
> while read UID GID COMMENT
> do
>  echo UID is $UID, GID is $GID, and it's $COMMENT"
> done < grep person /etc/passwd | awk -F":" '{ print $3, $4, $5 }'
>
> Does not work well at all. Any ideas?
>
> Thanks!
>
> Leam
>
> --
> Mind on a Mission <http://leamhall.blogspot.com/>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>


-- 
  Ed Cashin <ecashin at noserose.net>
  http://noserose.net/e/
  http://www.coraid.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130912/f6839949/attachment-0001.html>


More information about the Ale mailing list