Results 1 to 4 of 4
I have a file which has real numbers. the file has a number of lines and each line has 5 fields(words here numbers). Now my task is to check values ...
- 07-17-2008 #1Just Joined!
- Join Date
- Jun 2008
- Posts
- 3
bash script help
I have a file which has real numbers. the file has a number of lines and each line has 5 fields(words here numbers). Now my task is to check values in second field of each line and depending upon the range of value in which they fall take sum and then average of values in the first field. How to do so ?
i am trying it with awk but not able to do it?
file contents are like this
97.0600 34.9600 246. 0.7899180 259.775
97.1700 34.9600 247. 0.7931520 259.992
97.2700 34.9700 246. 0.7899180 259.775
97.3700 34.9700 245. 0.7866830 259.558
97.4800 34.9700 245. 0.7866830 259.558
97.5800 34.9800 243. 0.7802130 259.123
97.6800 34.9800 242. 0.7769790 258.904
97.7900 34.9900 240. 0.7705090 258.465
97.8900 34.9900 239. 0.7672750 258.245
97.9900 34.9900 240. 0.7705090 258.465
97.0300 34.8600 245. 0.7866830 259.558
97.1300 34.8600 247. 0.7931520 259.992
97.2400 34.8700 245. 0.7866830 259.558
97.3400 34.8700 243. 0.7802130 259.123
97.4400 34.8700 241. 0.7737440 258.685
97.5400 34.8800 241. 0.7737440 258.685
97.6500 34.8800 241. 0.7737440 258.685
97.7500 34.8900 241. 0.7737440 258.685
- 07-17-2008 #2Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
perl would be my tool of choice for this task. Have a go and ask for help when you need it.
- 07-17-2008 #3Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi, desidude3.
People will be willing to help if you post more details and your attempted awk script. Generally folks here like to help you help yourself, as opposed to writing code for you ... cheers, drlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 07-18-2008 #4Linux User
- Join Date
- Aug 2006
- Posts
- 458


Reply With Quote
