From: joljam on
Hi,

I have a unix file which looks like the following.

1. From this file I want to extract out the column labelled Safety
Factor and I want to write it to an external file.
2. This set of data keeps on repeating and I want to keep on appending
each instance of its occurence to the same external file.
Please help me in this regard.


Regards

Jolly
* MAXIMUM LINE TENSIONS. LF AND HF MOTION *
------------------------------------------------

** Line Dynamics Included **

Line ---- Top tension ---- Max.
Direction Type
No. Mean Max Safety Segm. tangent from hor.
(kN) (kN) factor No. motion (m)
plane (deg)

1 2687.3 4538.5 4.07 3 12.06
-60.6 SAM
2 2729.6 4578.2 4.03 3 12.25
-60.6 SAM
3 2776.7 4623.1 3.99 3 12.47
-60.5 SAM
4 2828.6 4666.1 3.95 3 12.74
-60.5 SAM
5 2885.4 4710.7 3.92 3 13.05
-60.5 SAM
6 5704.8 14472.9 1.28 3 19.04
-44.3 SAM
7 5756.4 14627.2 1.26 3 19.12
-44.2 SAM
8 5773.8 14678.8 1.26 3 19.15
-44.2 SAM
9 5756.4 14627.2 1.26 3 19.12
-44.2 SAM
10 5704.8 14473.3 1.28 3 19.04
-44.3 SAM
11 2885.4 4710.5 3.92 3 13.06
-60.5 SAM
12 2828.6 4665.1 3.96 3 12.74
-60.5 SAM
13 2776.7 4620.9 3.99 3 12.47
-60.5 SAM
14 2729.6 4577.6 4.03 3 12.25
-60.6 SAM
15 2687.3 4535.8 4.07 3 12.06
-60.6 SAM

SAM = Tensions are estimated with the Simplified Analytic Method
HF max tension: Non-Rayleigh based
LF max offset : Non-Rayleigh based

MIMOSA Version 5.7-03 05-JUN-2008 12:58
MARINTEK
Page
8
100 yr wave




Details on dynamic tension (in kN):
-------------------------------------------------------
Line Standard Maximum Maximum Zero crossing
No. deviation amplitude tension period (s)
-------------------------------------------------------
1 396.5 1428.5 4538.5 15.58
2 405.1 1461.9 4578.2 15.53
3 415.4 1501.1 4623.1 15.49
4 425.6 1539.0 4666.1 15.45
5 436.8 1580.2 4710.7 15.40
6 646.0 2341.6 14472.9 15.15
7 648.8 2351.6 14627.2 15.15
8 649.7 2355.0 14678.8 15.15
9 648.8 2351.6 14627.2 15.15
10 646.0 2341.6 14473.3 15.15
11 436.9 1580.3 4710.5 15.40
12 425.4 1538.2 4665.1 15.44
13 414.9 1498.9 4620.9 15.49
14 405.1 1461.8 4577.6 15.53
15 395.8 1425.8 4535.8 15.57
From: Barry Margolin on
In article
<f5d29d13-d0cd-40d7-94a9-4d28e64ef452(a)e53g2000hsa.googlegroups.com>,
joljam <joljam(a)gmail.com> wrote:

> Hi,
>
> I have a unix file which looks like the following.
>
> 1. From this file I want to extract out the column labelled Safety
> Factor and I want to write it to an external file.
> 2. This set of data keeps on repeating and I want to keep on appending
> each instance of its occurence to the same external file.
> Please help me in this regard.

awk '/Safety/ {intable=1}
/Details/ {intable=0}
intable && $4 ~ /^[0-9.]*$/ {print $4}' inputfile > outputfile

>
>
> Regards
>
> Jolly
> * MAXIMUM LINE TENSIONS. LF AND HF MOTION *
> ------------------------------------------------
>
> ** Line Dynamics Included **
>
> Line ---- Top tension ---- Max.
> Direction Type
> No. Mean Max Safety Segm. tangent from hor.
> (kN) (kN) factor No. motion (m)
> plane (deg)
>
> 1 2687.3 4538.5 4.07 3 12.06
> -60.6 SAM
> 2 2729.6 4578.2 4.03 3 12.25
> -60.6 SAM
> 3 2776.7 4623.1 3.99 3 12.47
> -60.5 SAM
> 4 2828.6 4666.1 3.95 3 12.74
> -60.5 SAM
> 5 2885.4 4710.7 3.92 3 13.05
> -60.5 SAM
> 6 5704.8 14472.9 1.28 3 19.04
> -44.3 SAM
> 7 5756.4 14627.2 1.26 3 19.12
> -44.2 SAM
> 8 5773.8 14678.8 1.26 3 19.15
> -44.2 SAM
> 9 5756.4 14627.2 1.26 3 19.12
> -44.2 SAM
> 10 5704.8 14473.3 1.28 3 19.04
> -44.3 SAM
> 11 2885.4 4710.5 3.92 3 13.06
> -60.5 SAM
> 12 2828.6 4665.1 3.96 3 12.74
> -60.5 SAM
> 13 2776.7 4620.9 3.99 3 12.47
> -60.5 SAM
> 14 2729.6 4577.6 4.03 3 12.25
> -60.6 SAM
> 15 2687.3 4535.8 4.07 3 12.06
> -60.6 SAM
>
> SAM = Tensions are estimated with the Simplified Analytic Method
> HF max tension: Non-Rayleigh based
> LF max offset : Non-Rayleigh based
>
> MIMOSA Version 5.7-03 05-JUN-2008 12:58
> MARINTEK
> Page
> 8
> 100 yr wave
>
>
>
>
> Details on dynamic tension (in kN):
> -------------------------------------------------------
> Line Standard Maximum Maximum Zero crossing
> No. deviation amplitude tension period (s)
> -------------------------------------------------------
> 1 396.5 1428.5 4538.5 15.58
> 2 405.1 1461.9 4578.2 15.53
> 3 415.4 1501.1 4623.1 15.49
> 4 425.6 1539.0 4666.1 15.45
> 5 436.8 1580.2 4710.7 15.40
> 6 646.0 2341.6 14472.9 15.15
> 7 648.8 2351.6 14627.2 15.15
> 8 649.7 2355.0 14678.8 15.15
> 9 648.8 2351.6 14627.2 15.15
> 10 646.0 2341.6 14473.3 15.15
> 11 436.9 1580.3 4710.5 15.40
> 12 425.4 1538.2 4665.1 15.44
> 13 414.9 1498.9 4620.9 15.49
> 14 405.1 1461.8 4577.6 15.53
> 15 395.8 1425.8 4535.8 15.57

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***