Register
It is currently Tue Jul 22, 2014 5:21 am

script to paste the results from multiple lines from /etc/pa


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Nov 20, 2011 4:15 am   

Joined: Tue Dec 11, 2007 10:21 pm
Posts: 20
Hello , does anyone has any ideea for a script which will do this:

i have shell file /etc/passwd and i whant to paste me the information from /etc/passwd into a file but i need only this informations:

original /etc/passwd = bind:*:53:53:Bind Sandbox:/:/usr/sbin/nologin
new file = bind Bind Sandbox

i only whant to take the username and the name of it not the rest , and i whant it for all users which all is different.

any ideea?

thanks.


Top
 Profile  
 PostPosted: Sun Nov 20, 2011 9:54 am   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
Code:
awk -F: '{ print $1, $5 }' < <(getent passwd) > new_file


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP