[CentOS] UC UC Need help in writing a shell/bash script

Fri Dec 30 15:14:32 UTC 2011
Rushton Martin <JMRUSHTON at qinetiq.com>

Demonstration purposes only.  I wanted to show the data going is was the
user's data as described.  The awk script is the key, the cat and sort
are merely decoration. 

Martin Rushton
HPC System Manager, Weapons Technologies
Tel: 01959 514777, Mobile: 07939 219057
email: jmrushton at QinetiQ.com
QinetiQ - Delivering customer-focused solutions

Please consider the environment before printing this email.
-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On
Behalf Of m.roth at 5-cent.us
Sent: 30 December 2011 15:06
To: CentOS mailing list
Subject: Re: [CentOS] UC Need help in writing a shell/bash script

Rushton Martin wrote:
> I knocked up the enclosed under Cygwin:
> #!/bin/sh
> (
> 	cat <<EOTx
>                 admin                      ankush
>                 admin                       amit
>                 powerusers               dinesh
>                 powerusers               jitendra
> EOTx
> ) | awk '
> 	{
> 		grpnm[$1] = grpnm[$1] ", " $2
> 	}
> 	END {
> 		for (i in grpnm) {
> 			print i ":	" substr(grpnm[i], 3)
> 		}
> 	}
> ' | sort
Why use cat? Why not just stick the filename in the command line, right
after the closing ', and before the pipe?


CentOS mailing list
CentOS at centos.org
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is 
addressed. If you are not the intended recipient of this email,
you must neither take any action based upon its contents, nor 
copy or show it to anyone. Please contact the sender if you 
believe you have received this email in error. QinetiQ may 
monitor email traffic data and also the content of email for 
the purposes of security. QinetiQ Limited (Registered in England
& Wales: Company Number: 3796233) Registered office: Cody Technology 
Park, Ively Road, Farnborough, Hampshire, GU14 0LX  http://www.qinetiq.com.