awk script combining mutiple commands

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

awk script combining mutiple commands

Mark Well
Hi,

I am pretty new to the unix community and have encountered a problem that I am trying to solve.  I have 2 files one of which is called passwd file that looks like the following

Sample Output

daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh

and the other a file called group which looks like the following

Sample Output

gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:john,martin
sasl:x:45:

So using a combination of sort/cut/grep/awk/join/paste/sed I need to create a txt file where the output would be placed and  looks like the following based on user is the passwd file having :"bin/bash" on their column. The new file will have the users and groups both in alphabetical order. It should look something like this apparently.

Sample Output

User: prof
Groups: course prof test

User: student
Groups: course othercourse student

If anyone can help me please it would be greatly appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: awk script combining mutiple commands

Guru
Administrator
Can you please post a sample output which has relevane to the sample input provided?