data file sort problem
Hi.
I'm working with a seismic data file. $1 : earthquake number $2 : seismometer $3 : backazimuth of earthquake relative to seismometer The number of seismometers which pick up the earthquake signal depends on, among other things, it's magnitude. This means I have a data file that looks something like: 1 a 65.3 1 b 65.2 1 c 65.1 2 b 88.7 2 d 88.5 3 b 125.1 3 c 125.2 3 d 125.3 3 e 125.4 etc.... where a,b,c,d,e are the seismometers. I'd like to sort the data according to backazimuth range - eg extract all earthquakes coming from the backazimuth range 60 - 80. This is easily done in awk. My problem is that the code to which I'm passing the data file (which I don't want to tinker with!) requires the earthquake index to run from 1 - n continuously. So, just taking the first column, after extraction of certain events it might look like: 1 1 4 4 4 4 7 7 7 11 11 11 11 11 11 etc... Does anyone know how I could re-number this index to run from 1 - n continuously? ie so the above would become: 1 -> 1 1 -> 1 4 -> 2 4 -> 2 4 -> 2 4 -> 2 7 -> 3 7 -> 3 7 -> 3 11 -> 4 11 -> 4 11 -> 4 11 -> 4 11 -> 4 11 -> 4 Thanks. |
In your awk code you can insert something like this, for lines that match the requirements and have to be printed
Code:
{ |
thanks! - appreciate your help
|
All times are GMT -5. The time now is 12:56 AM. |