The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-27-2007
craigsky craigsky is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 6
arrays in awk???

Been struggling with a problem, I have been trying to do this in awk, but am unable to figure this out, I think arrays have to be used, but unsure how to accomplish this.

I have a input file that looks like this:

141;ny;y;g
789;ct;e;e
23;ny;n;u
45;nj;e;u
216;ny;y;u
7;ny;e;e
1456;ny;e;g
2;ct;n;e

I want the output to look like this:

ny: 141 23 216 7 1456
ct: 789 2
nj: 45


Is this possible? I know it is, but I can't figure it out, would like to use awk if possible.

thanks in advance.