Hello,
I am very new at this and I am looking for a lot of help. I have data that I need to extract values from, perform calculations and then write to another file.

I would like to write all of the x,y values for the POINTs to File2 and all the VERTEX x,y values to File1. The x value is on line 4 from both VERTEX and POINT and the y value on line 6 from both VERTEX and POINT.

So File1 is a list of VERTEX and looks like
vx1, vy1
vx2, vy2
vx3, vy3
vx4, vy4
vx5, vy5
vx6, vy6
... and File2 is a list of POINTs and looks like
xp1, yp2
xp2, yp2
... Every xp1, yp1 in File2 is also located in File1. I need to find these points xp1, yp1 in File1, delete it, and replace it with two new values, a new vx, vy.

example--- xp1, yp1 is the same value as vx3, vy3. I need vx2, vy2 and vx4, vy4 to do calculations. Then I need to delete vx3, vy3 and replace it with vx31, vy31 and vx32, vy32.

Below is the same data that I am using and what values I need. Thanks for your help and I hope to hear from you soon. > > example
> > VERTEX
> > 8
> > 1
> > 10
> > 440.5282 26 (Vertex vx1)
> > 20
> > 267.931852 (Vertex vy1)
> > 0
> > VERTEX
> > 8
> > 1
> > 10
> > 903.665710 (Vertex vx2 - x1 value for > > calculation)
> > 20
> > 424.695464 (Vertex vy2 - y1 value for > > calculation)
> > 0
> > VERTEX
> > 8
> > 1
> > 10
> > 851.607625 (Vertex vx3 - Also POINT xp1)
> > 20
> > 496.102325 (Vertex vy3 - Also POINT yp1)
> > 0
> > VERTEX
> > 8
> > 1
> > 10
> > 828.895143 (Vertex vx4 - x2 value for > > calculation)
> > 20
> > 526.760804 (Vertex vy4 - y2 value for > > calculation)
> > 0
> > VERTEX
> > 8
> > 1
> > 10
> > 401.846293 (Vertex vx5)
> > 20
> > 382.212539 (Vertex vy5)
> > 0
> > VERTEX
> > 8
> > 1
> > 10
> > 440.528226 (Vertex vx6 - same as vx1-completes > > loop)
> > 20
> > 267.931852 (Vertex vy6 - same as vy1-completes > > loop)
> > 0
> > SEQEND
> > 0
> > POINT
> > 8
> > 4
> > 10
> > 851.607625 (POINT xp1)
> > 20
> > 496.102325 (POINT yp1)
> > 50
> > 214.96
> > 0
> > ENDBLK

edited: Sat Feb 1 16:03:10 2003 by jeffa - title change (was: Please help)


In reply to Basic file processing by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.