[CentOS] UC Need help in writing a shell/bash script
m.roth at 5-cent.us
m.roth at 5-cent.us
Fri Dec 30 15:05:41 UTC 2011
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
>
<snip>
Why use cat? Why not just stick the filename in the command line, right
after the closing ', and before the pipe?
mark
More information about the CentOS
mailing list