bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IFS system variable


From: Ian Macdonald
Subject: Re: IFS system variable
Date: Wed, 13 Feb 2002 21:06:40 -0800
User-agent: Mutt/1.2.5.1i

On Thu 14 Feb 2002 at 04:24:39 +0000, you wrote:

> I tried:
> export IFS=:
> 
> grep eric /etc/passwd |awk '{print $5}'
> 
> still not working. I'm just trying to print 5th field from /etc/passwd 
> that will show users full name.
>
> Maybe You know different way of doing this, if so please let me know.
> Thanks again for Your time.

How about changing the field separator in awk, rather than in bash?

You could also so away with the grep while you're at it:

    awk '{FS=":"; if ($5 ~ /eric/) {print $5}}' /etc/passwd

Ian
-- 
Ian Macdonald               | Today is a good day for
address@hidden             | information-gathering.  Read someone else's
                            | mail file. 
                            | 
                            | 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]