0

I have an input textfile that looks like this

Field1A
  Field2 : A1
    Field3 : A1.5
      Field4: 1
      Field4: 1.5
  Field2 : A2
    Field4: 2     

Field1B
  Field2 : B1
    Field3 : B1.5
      Field4: 3   
      Field4: 4

Field1C
  Field2 : C 
    Field4: 5      

and a textfsm template that looks like this

Value Filldown FIELD1 (\S+)
Value Filldown FIELD2 (\S+)
Value Filldown FIELD3 (\S+)
Value Required FIELD4 (\S+)


Start
  ^\s*${FIELD1}\s*$$
  ^\s*Field2\s*:\s*${FIELD2}\s*
  ^\s*Field3\s*:\s*${FIELD3}\s*
  ^\s*Field4:\s*${FIELD4}\s* -> Record

This should give me an output where the Field3 is only getting populated for the field4 rows that it is applicable for but it is populating for even the field4 rows that it's not a part of.

The ideal output should look like this

FIELD1    FIELD2    FIELD3      FIELD4
--------  --------  --------  --------
Field1-A  A1        A1.5           1
Field1-A  A1        A1.5           1.5
Field1-A  A2                       2
Field1-B  B1        B1.5           3
Field1-B  B1        B1.5           4
Field1-C  C                        5

but I'm getting this output below

FIELD1    FIELD2    FIELD3      FIELD4
--------  --------  --------  --------
Field1-A  A1        A1.5           1
Field1-A  A1        A1.5           1.5
Field1-A  A2        A1.5           2
Field1-B  B1        B1.5           3
Field1-B  B1        B1.5           4
Field1-C  C         B1.5           5

what is the ideal fix for this issue ?

0 Answers0