UNIX Bourne shell script

Lars Schylberg larss at fmi.kth.se
Sun Apr 25 14:55:51 EDT 1993

I hope that I have understood your question correctly but I think
this line should do the trick.

 cat file | awk '{ for ( i=1; i <= $1 ; i++ ) print $2 }'


Lars Schylberg                          Email: larss at fmi.kth.se  
Dept. of Geodesy and Photogrammetry 
Royal Institute of Technology (KTH)     Tel.   +46 8 790 86 33   
S-100 44  STOCKHOLM, SWEDEN             Fax.   +46 8 790 66 10

> I hope someone out there can give me some advice on how I might put
> together a loop that would take a file with two columns and n rows
> the first field contains a number which indicates the number of times
> a particular easting occurs in a file of coordinates representing nodes in 
> a road network. This file was processed to output the duplicate and unique
> coordinates and the number of times they occur.
> So i need to create a nested loop which will process the file n times and
> within that loop echo the Easting the number of times it occurs in the original file  >> into a file then go to the next line and
> take the first field ( the number) and echo that easting the number of times
> it occurs etc. 

More information about the grass-user mailing list