LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   select only user who use /bin/bash shell from the /etc/passwd folder (https://www.linuxquestions.org/questions/linux-newbie-8/select-only-user-who-use-bin-bash-shell-from-the-etc-passwd-folder-907341/)

rohitbhpune 10-10-2011 03:02 AM

select only user who use /bin/bash shell from the /etc/passwd folder
 
Hi,

How can I select only user who use /bin/bash shell from the /etc/passwd folder and copy them in another file?

colucix 10-10-2011 03:11 AM

You can try sed or awk:
Code:

$ sed -n '\:/bin/bash$:p' /etc/passwd
$ awk -F: '$NF == "/bin/bash"' /etc/passwd


rohitbhpune 10-10-2011 03:14 AM

awasome..works perfect...tanks a lot..

David the H. 10-11-2011 09:21 AM

What's wrong with a simple grep?
Code:

grep '/bin/bash' /etc/passwd


All times are GMT -5. The time now is 10:40 AM.