Chemist Needs Help part II


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Chemist Needs Help part II
# 1  
Old 12-17-2008
Chemist Needs Help part II

[SIZE=1]Hello friends,

I was wondering if you can help me with probably a simple function to you all: the sample looks and has this format. I was wondering how I could extract the first and second column starting including the line 'E/N and Ko' and not stop until there are no more lines. Thank you for all your help. I want to note that for your help I do donate to this forum.

Lenny



Cl- -Ar
MP5test-nocp

The gas temperature is 298.00 K.
Fractional accuracy for Ko is 1.0000%,
for NDx and NDz is 10.0000%,
and for the other quantities is 30.0000%.

E/N Ko Tz Tx NDz NDx 1+SKEW KURz KURx 1+C1 C2

0.69 3.8107 298.3 298.0 2.628 2.623 1.002 3.001 3.001 1.001 0.999
2.11 3.8124 299.2 298.5 2.640 2.629 1.008 3.002 3.001 1.003 1.000
2.96 3.8143 300.2 299.1 2.654 2.636 1.011 3.003 3.002 1.004 1.000
3.55 3.8159 301.1 299.7 2.665 2.642 1.014 3.004 3.002 1.004 1.000
4.26 3.8183 302.4 300.4 2.682 2.650 1.017 3.005 3.003 1.005 1.000
5.10 3.8217 304.3 301.5 2.709 2.663 1.021 3.007 3.003 1.007 1.001
5.86 3.8252 306.3 302.7 2.735 2.676 1.025 3.010 3.005 1.008 1.001
6.74 3.8298 309.0 304.3 2.770 2.693 1.030 3.013 3.006 1.010 1.002
7.74 3.8358 312.5 306.3 2.816 2.716 1.036 3.017 3.008 1.012 1.003
8.50 3.8408 315.5 308.1 2.855 2.735 1.041 3.021 3.010 1.013 1.004
9.34 3.8468 319.2 310.2 2.904 2.759 1.048 3.025 3.012 1.015 1.005
10.26 3.8540 323.8 312.7 2.963 2.787 1.056 3.030 3.015 1.017 1.006
10.75 3.8581 326.5 314.2 2.996 2.803 1.060 3.033 3.017 1.019 1.007
11.28 3.8625 329.4 315.9 3.034 2.822 1.065 3.037 3.019 1.020 1.008
11.83 3.8673 332.6 317.8 3.075 2.842 1.071 3.041 3.021 1.022 1.010
12.40 3.8725 336.2 319.8 3.120 2.865 1.077 3.046 3.024 1.023 1.011
13.01 3.8780 340.1 322.1 3.170 2.890 1.083 3.052 3.027 1.025 1.012
13.64 3.8839 344.5 324.6 3.226 2.917 1.091 3.058 3.030 1.027 1.014
14.30 3.8903 349.2 327.4 3.286 2.948 1.099 3.065 3.034 1.030 1.016
14.98 3.8970 354.5 330.4 3.352 2.981 1.107 3.073 3.039 1.032 1.018
15.70 3.9043 360.3 333.7 3.425 3.017 1.117 3.082 3.044 1.035 1.020
16.46 3.9119 366.8 337.4 3.504 3.058 1.127 3.092 3.049 1.038 1.022
17.24 3.9199 373.8 341.5 3.591 3.102 1.138 3.103 3.056 1.041 1.025
17.55 3.9232 376.8 343.2 3.622 3.119 1.143 3.108 3.059 1.043 1.026
17.89 3.9266 380.0 345.0 3.661 3.139 1.148 3.113 3.062 1.044 1.028
18.23 3.9301 383.3 346.9 3.700 3.159 1.153 3.118 3.065 1.046 1.029
18.57 3.9336 386.7 348.9 3.741 3.181 1.158 3.123 3.068 1.047 1.030
18.93 3.9372 390.3 350.9 3.783 3.203 1.164 3.129 3.072 1.049 1.032
19.28 3.9408 394.0 353.1 3.827 3.225 1.169 3.134 3.075 1.051 1.033
19.65 3.9445 397.9 355.3 3.872 3.249 1.175 3.140 3.079 1.053 1.035
20.02 3.9481 401.9 357.6 3.918 3.274 1.181 3.147 3.083 1.054 1.037
20.40 3.9519 406.1 360.0 3.966 3.299 1.187 3.153 3.087 1.056 1.038
20.78 3.9556 410.4 362.4 4.017 3.326 1.193 3.160 3.092 1.058 1.040
21.17 3.9593 414.9 365.0 4.066 3.353 1.199 3.166 3.096 1.060 1.042
21.57 3.9631 419.5 367.7 4.118 3.381 1.206 3.173 3.101 1.062 1.044
21.97 3.9668 424.4 370.5 4.172 3.411 1.212 3.180 3.106 1.064 1.046
22.39 3.9704 429.4 373.3 4.228 3.441 1.220 3.189 3.107 1.066 1.050
22.80 3.9743 434.7 376.4 4.283 3.473 1.226 3.195 3.116 1.068 1.050
23.23 3.9780 440.1 379.5 4.342 3.505 1.233 3.203 3.122 1.071 1.052
23.67 3.9818 445.7 382.7 4.401 3.539 1.240 3.211 3.128 1.073 1.054
24.11 3.9855 451.5 386.1 4.462 3.574 1.247 3.219 3.135 1.075 1.056
24.56 3.9891 457.5 389.6 4.527 3.610 1.255 3.227 3.141 1.078 1.059
25.02 3.9927 463.8 393.2 4.591 3.647 1.262 3.238 3.146 1.080 1.061
25.48 3.9963 470.3 396.9 4.654 3.686 1.270 3.247 3.153 1.083 1.063
25.96 3.9999 477.0 400.8 4.722 3.726 1.277 3.253 3.162 1.085 1.065
26.44 4.0034 483.9 404.8 4.790 3.767 1.285 3.260 3.168 1.088 1.068
26.94 4.0069 491.1 409.0 4.860 3.809 1.292 3.268 3.176 1.090 1.071
27.44 4.0102 498.6 413.4 4.931 3.853 1.300 3.277 3.183 1.093 1.074
27.95 4.0136 506.4 417.8 5.005 3.898 1.308 3.285 3.192 1.096 1.076
28.47 4.0168 514.4 422.5 5.079 3.945 1.315 3.293 3.200 1.098 1.079
29.00 4.0199 522.7 427.3 5.154 3.994 1.323 3.301 3.208 1.101 1.082
29.54 4.0230 531.2 432.3 5.231 4.044 1.331 3.310 3.217 1.104 1.084
30.10 4.0261 540.1 437.5 5.308 4.095 1.338 3.318 3.226 1.107 1.087
30.66 4.0290 549.2 442.9 5.388 4.148 1.346 3.326 3.235 1.109 1.090
31.23 4.0321 558.6 448.5 5.467 4.203 1.353 3.334 3.244 1.112 1.092
31.81 4.0347 568.4 454.3 5.549 4.260 1.361 3.342 3.253 1.115 1.095
32.41 4.0371 578.6 460.3 5.632 4.319 1.368 3.350 3.262 1.118 1.098
33.02 4.0393 589.0 466.5 5.717 4.379 1.376 3.358 3.272 1.121 1.101
33.64 4.0413 599.9 473.0 5.802 4.441 1.383 3.365 3.282 1.123 1.103
34.27 4.0438 611.0 479.7 5.888 4.505 1.390 3.372 3.292 1.126 1.106
34.92 4.0456 622.6 486.6 5.976 4.572 1.397 3.379 3.302 1.129 1.109
35.58 4.0472 634.6 493.9 6.065 4.640 1.404 3.386 3.312 1.132 1.111
36.26 4.0486 647.1 501.4 6.163 4.711 1.411 3.392 3.323 1.135 1.114
36.95 4.0496 660.9 509.1 6.309 4.785 1.422 3.399 3.338 1.141 1.120
37.66 4.0495 675.0 516.8 6.420 4.855 1.442 3.427 3.347 1.140 1.122
38.38 4.0502 688.6 525.1 6.510 4.933 1.448 3.435 3.357 1.142 1.124
39.12 4.0521 700.8 534.3 6.526 5.018 1.438 3.425 3.366 1.144 1.119
39.86 4.0540 715.4 543.2 6.625 5.101 1.441 3.417 3.374 1.148 1.125
40.63 4.0547 730.5 552.6 6.720 5.186 1.446 3.420 3.384 1.150 1.127
41.42 4.0544 746.3 562.3 6.817 5.274 1.452 3.422 3.394 1.153 1.129
42.24 4.0537 762.5 572.4 6.920 5.365 1.457 3.425 3.405 1.155 1.131
43.07 4.0527 779.4 582.9 7.023 5.458 1.462 3.428 3.415 1.158 1.133
43.93 4.0508 797.0 593.7 7.128 5.555 1.467 3.430 3.426 1.160 1.135
44.81 4.0492 815.0 605.0 7.232 5.654 1.472 3.431 3.436 1.162 1.137
45.71 4.0473 833.7 616.8 7.339 5.757 1.476 3.432 3.446 1.165 1.138
46.63 4.0445 853.2 629.0 7.448 5.863 1.480 3.432 3.456 1.167 1.140
47.58 4.0419 873.2 641.7 7.558 5.973 1.484 3.432 3.466 1.169 1.141
48.55 4.0386 894.1 655.0 7.670 6.087 1.488 3.431 3.476 1.171 1.142
49.56 4.0350 915.7 668.7 7.784 6.203 1.492 3.430 3.486 1.173 1.144
50.58 4.0310 938.1 683.0 7.900 6.324 1.495 3.428 3.495 1.175 1.145
51.64 4.0266 961.2 697.9 8.017 6.450 1.497 3.425 3.505 1.177 1.145
52.73 4.0216 985.2 713.3 8.131 6.578 1.500 3.421 3.513 1.178 1.146
53.85 4.0159 1010.3 729.3 8.259 6.711 1.505 3.417 3.522 1.179 1.149
55.00 4.0106 1036.0 746.3 8.380 6.851 1.504 3.410 3.531 1.182 1.147
56.18 4.0041 1063.0 763.7 8.504 6.992 1.506 3.406 3.539 1.184 1.147
57.40 3.9973 1090.8 781.9 8.633 7.140 1.508 3.399 3.547 1.185 1.147
58.66 3.9903 1119.8 800.9 8.765 7.292 1.509 3.390 3.555 1.187 1.147
59.95 3.9833 1149.6 821.0 8.899 7.453 1.509 3.376 3.561 1.188 1.147
61.29 3.9778 1180.9 842.4 9.041 7.623 1.506 3.344 3.567 1.189 1.145
62.66 3.9595 1216.5 862.3 9.356 7.816 1.519 3.371 3.571 1.192 1.138
64.09 3.9543 1253.9 885.4 9.562 7.999 1.519 3.354 3.574 1.190 1.142
65.56 3.9262 1277.9 904.1 9.413 8.101 1.543 3.537 3.595 1.192 1.155
67.04 3.9276 1315.0 930.9 9.611 8.311 1.525 3.415 3.597 1.193 1.150
68.60 3.9191 1354.4 956.8 9.773 8.506 1.521 3.367 3.602 1.194 1.148
70.21 3.8729 1379.4 973.9 9.761 8.630 1.577 3.750 3.617 1.193 1.163
71.81 3.8889 1427.8 1008.2 10.071 8.899 1.530 3.437 3.613 1.196 1.150
73.56 3.8778 1474.3 1037.6 10.246 9.110 1.527 3.375 3.619 1.196 1.147
75.34 3.8393 1502.4 1060.6 10.253 9.276 1.570 3.690 3.626 1.195 1.159
77.10 3.8464 1558.1 1096.5 10.576 9.548 1.531 3.418 3.627 1.198 1.148
79.03 3.8332 1611.6 1129.4 10.780 9.777 1.526 3.347 3.636 1.199 1.145
81.00 3.8114 1656.4 1161.4 10.918 10.004 1.537 3.418 3.642 1.199 1.147
83.00 3.8031 1714.0 1198.4 11.155 10.268 1.520 3.308 3.645 1.201 1.142
85.11 3.7812 1774.9 1226.6 11.350 10.446 1.518 3.399 3.679 1.205 1.144
87.27 3.7922 1828.6 1283.1 11.372 10.866 1.482 3.296 3.635 1.198 1.133
89.53 3.7618 1906.4 1309.4 11.782 11.018 1.513 3.426 3.683 1.205 1.145
91.88 3.7473 1956.3 1360.1 11.954 11.383 1.497 3.346 3.664 1.204 1.139
94.24 3.7251 2015.6 1405.2 12.202 11.694 1.510 3.316 3.653 1.201 1.143
96.69 3.6817 2067.8 1440.2 12.581 11.921 1.538 3.324 3.674 1.205 1.146
99.15 3.6607 2123.2 1485.2 12.644 12.224 1.539 3.375 3.668 1.203 1.145
101.71 3.6397 2184.6 1532.8 12.809 12.540 1.540 3.410 3.664 1.201 1.144
104.38 3.6209 2274.2 1582.7 13.181 12.860 1.525 3.260 3.674 1.203 1.138
107.30 3.5939 2339.2 1636.3 13.359 13.206 1.539 3.351 3.673 1.202 1.142
110.14 3.5718 2412.7 1690.4 13.614 13.555 1.541 3.372 3.673 1.202 1.142
113.10 3.5489 2490.8 1746.9 13.880 13.912 1.542 3.385 3.674 1.202 1.143
116.16 3.5256 2571.5 1806.0 14.149 14.283 1.544 3.402 3.674 1.202 1.143
119.28 3.5024 2634.8 1868.4 14.308 14.679 1.559 3.551 3.664 1.200 1.147
122.47 3.4797 2753.0 1929.5 14.798 15.043 1.537 3.359 3.679 1.204 1.141
125.97 3.4536 2848.7 1998.2 15.099 15.460 1.542 3.362 3.682 1.203 1.142
129.48 3.4286 2946.8 2068.2 15.429 15.881 1.543 3.364 3.684 1.203 1.142
133.10 3.4034 3049.1 2140.8 15.773 16.313 1.544 3.364 3.686 1.204 1.142
136.84 3.3779 3155.8 2216.4 16.130 16.758 1.544 3.362 3.688 1.204 1.143
140.70 3.3522 3266.9 2295.1 16.501 17.218 1.545 3.360 3.690 1.204 1.143
144.68 3.3264 3381.9 2377.6 16.881 17.695 1.545 3.359 3.691 1.204 1.143
148.79 3.3004 3502.1 2463.0 17.277 18.183 1.546 3.358 3.693 1.205 1.144
153.03 3.2742 3627.3 2552.0 17.689 18.687 1.547 3.356 3.695 1.205 1.144
157.41 3.2479 3757.6 2644.7 18.116 19.206 1.548 3.355 3.697 1.205 1.145
161.93 3.2214 3893.2 2741.1 18.558 19.741 1.548 3.353 3.699 1.205 1.145
166.59 3.1949 4034.6 2841.4 19.018 20.291 1.549 3.352 3.702 1.206 1.146
171.41 3.1683 4181.4 2946.1 19.492 20.861 1.550 3.351 3.704 1.206 1.146
176.37 3.1417 4334.1 3055.1 19.984 21.448 1.551 3.350 3.707 1.207 1.147
181.48 3.1151 4493.0 3168.6 20.493 22.054 1.551 3.349 3.709 1.207 1.147
186.76 3.0885 4658.3 3286.8 21.020 22.679 1.552 3.349 3.712 1.207 1.147
192.20 3.0619 4830.4 3409.9 21.566 23.323 1.553 3.348 3.714 1.208 1.148
197.81 3.0353 5009.4 3538.1 22.132 23.988 1.553 3.347 3.717 1.208 1.148
203.60 3.0088 5195.7 3671.6 22.717 24.675 1.554 3.346 3.720 1.209 1.149
209.56 2.9824 5389.4 3810.7 23.323 25.383 1.554 3.344 3.722 1.209 1.149
215.70 2.9561 5591.0 3955.6 23.950 26.114 1.555 3.343 3.725 1.209 1.150
222.03 2.9298 5800.8 4106.5 24.599 26.869 1.556 3.342 3.728 1.210 1.150
228.56 2.9037 6018.9 4263.7 25.272 27.648 1.556 3.341 3.730 1.210 1.150
235.28 2.8777 6246.0 4427.5 25.968 28.452 1.557 3.339 3.733 1.211 1.151
242.21 2.8519 6482.3 4598.0 26.690 29.282 1.557 3.338 3.736 1.211 1.151
249.34 2.8262 6728.1 4775.7 27.437 30.140 1.557 3.336 3.739 1.211 1.151
256.69 2.8006 6983.9 4960.9 28.212 31.027 1.558 3.335 3.742 1.212 1.151
264.27 2.7752 7249.8 5154.0 29.013 31.943 1.558 3.334 3.744 1.212 1.151
272.06 2.7501 7526.5 5355.2 29.843 32.891 1.559 3.332 3.747 1.213 1.151
280.10 2.7251 7812.8 5566.1 30.692 33.878 1.559 3.331 3.748 1.213 1.152
# 2  
Old 12-17-2008
Code:
awk '{ if (NR>8) {print $1, $2} else {continue}}' transport.txt > newfile

Let's try this first.
# 3  
Old 12-17-2008
I get this error

awk: (FILENAME=transport FNR=1) fatal: `continue' outside a loop is not allowed

Thanks
# 4  
Old 12-18-2008
Hello

I tried it and got a similar err. But I took the offered solution and dropped out the 'else' part of the statement.

Code:
 awk '{ if (NR>8) { print $1, $2 } }' /tmp/transport.txt > newfile


worked perfectly

yrs


Michael
# 5  
Old 12-18-2008
my bad - continue should be "next" or not there at all.
# 6  
Old 12-18-2008
Jim:
Code:
ant:/test $ awk '{ if (NR>8) {print $1, $2} else {continue}}' transport.txt > newfile
ant:/test $ more newfile                                                       
 
E/N Ko
 
0.69 3.8107
2.11 3.8124
2.96 3.8143
3.55 3.8159
4.26 3.8183
5.10 3.8217
5.86 3.8252
6.74 3.8298
7.74 3.8358
8.50 3.8408
9.34 3.8468
10.26 3.8540
10.75 3.8581
11.28 3.8625
11.83 3.8673
12.40 3.8725
13.01 3.8780
13.64 3.8839
14.30 3.8903
14.98 3.8970
15.70 3.9043
16.46 3.9119
17.24 3.9199
17.55 3.9232
17.89 3.9266
18.23 3.9301
....
.90 2.5105
374.63 2.4879
385.66 2.4655
397.02 2.4434
408.70 2.4216
420.70 2.4001
433.05 2.3788
445.75 2.3579
458.81 2.3372
472.23 2.3169
486.02 2.2968
500.18 2.2771
514.73 2.2577
529.69 2.2386
545.04 2.2198
560.80 2.2013
576.98 2.1831
593.59 2.1653
610.63 2.1477
628.11 2.1305
646.04 2.1136
664.43 2.0970
683.27 2.0807
702.58 2.0648
722.37 2.0492
742.64 2.0339
763.40 2.0190
784.66 2.0046
806.41 1.9910
828.65 1.9616
852.10 1.9598
874.97 1.9483
ant:/test $

HP-UX 11.11...
At least your code works here...

All the best
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to make a loop to read the input from a file part by part?

Hi All, We've a VDI infrastructure in AWS (AWS workspaces) and we're planning to automate the process of provisioning workspaces. Instead of going to GUI console, and launching workspaces by selecting individual users is little time consuming. Thus, I want to create them in bunches from AWS CLI... (6 Replies)
Discussion started by: arun_adm
6 Replies

2. Shell Programming and Scripting

Part of log

hi, i have a requirement where i need to grep the part of the log file of last 5 minutes back. 00000011 ViewReceiver I DCSV1033I: DCS Stack DefaultCoreGroup at Member usa0300ux423Cell01\usa0300ux423QASrv02\server1: Confirmed all new view members in view identifier... (4 Replies)
Discussion started by: lovelysethii
4 Replies

3. Shell Programming and Scripting

[Solved] Printing a part of the last line of the specific part of a file

Hi, I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this: Name =A xxxxxx yyyyyy zzzzzz aaaaaa bbbbbb Value = 57 This is necessary because in a file there are written more lines which... (6 Replies)
Discussion started by: wenclu
6 Replies

4. Shell Programming and Scripting

comparing part of header with part of detailed records.

Hi there, I am lil confused with the following issue. I have a File, which has the following header: IMSHRATE_043008_101016 a sample detailed record is :9820101 A982005000CAVG030108000000000000010169000MAR 2008 9820102 MAR 2008 D030108 ... (1 Reply)
Discussion started by: cmaroju
1 Replies

5. UNIX for Dummies Questions & Answers

Chemist Needs Help

Hello All I am a chemist and really dont know too much about programming but here goes. Essentially I need to create a script that I can run which will do the following. Create a file where the first four lines are a set of commands that are the same for all the files. E.g ln1: comment... (40 Replies)
Discussion started by: gingburg
40 Replies

6. Shell Programming and Scripting

get integer part

Hi, I did a df|awk| command and it returns a percentage "94%", how could I only get the integer part "94" out of it, so I can compare it to another number, I knwo that I have to pipe it to sth, but "grep " did not work, it still give me number WITH the percentage, does someone know what... (3 Replies)
Discussion started by: ericaworld
3 Replies

7. Shell Programming and Scripting

help me in this part

why we use strcpy and strcat in KSH program?? (1 Reply)
Discussion started by: debasis.mishra
1 Replies

8. Shell Programming and Scripting

Help part 2

Ok well this isn't homework or classwork, I have been done with school for many years. I offered to help my co-worker who's daughter needs help. I didn't realize I had got rid of all of my UNIX books until after I agreed to help. (3 Replies)
Discussion started by: penguin123
3 Replies
Login or Register to Ask a Question