Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Define each line of data in a file as it updates

Status
Not open for further replies.

fixengineer

Technical User
Apr 5, 2007
19
US
I need to be able to determine the purpose of each line of a file. And track any future references to any past lines.

Here are conditions:

if line has "ObjectName", then line is "Object"

if file has "TOP" and "Bottom" in it, line is "locater".

If line has + and * then line is "math"

if line's LineNumber=value has been seen before in a line previously defined as "Object", and line has "TOP" and "Bottom" then line is a new locater for previous "Object" with LineNumber=value.

I/O like this:
LineNumber=1 Green ObjectName=Car
____________________
New object received
____________________
LineNumber=2 3+4

_____________________
New math received

LineNumber=1 Top of bottom

______________________
New locater for LineNumber=1 Object

I need definitions of line type which are determined by processing an evaluation stream:

Does object have X?
Does Object have Y?
if object has Y, does it have B too

Once this has been done we can look at definitions and see if we have matches. Object has A and B, so what definition matches this? If match found, then line is that definition.

Big thing is to track each line for future updates, so will need to hold line numbers and previous definitions in a variable or file.

Thanks for any help or suggestions.
 
It sounds like perl or awk would be perfect for this task, but... I can't make sense of your requirements. Can you simply post some sample input and the desired output perhaps?

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top