Hello,
I have the following input file (example only, actual file has many more lines)...
A1 A2 B2 B1 Q2 Q3 S2
B4 A2 B2 B1 Q2 Q4 S2
B4 A2 B2 B1 Q1 Q3 S1
A1 A2 B2 B1 Q2 Q3 S2
A1 A2 A3 B1 Q2 Q4 S2
I need to first substitute fields 5 & 6, Qn and Qm, with values from the first 4 fields (n and m correspond to the field position).
For example, the first line would become (after substitution)...
A1 A2 B2 B1 A2 B2 S2
Following this, I then need to replace field 7, Sx, with values from fields 5 and 6. Here, if field 7 has a value of 'S1', it would be changed to the value from field 5 and 'S2' would be changed to the value from field 6.
Continuing with the example, the line would further modify to...
A1 A2 B2 B1 A2 B2 B2
Use of awk or sed or any combination thereof or any other method is fine.
Your help is very much appreciated...
Arun
I have the following input file (example only, actual file has many more lines)...
A1 A2 B2 B1 Q2 Q3 S2
B4 A2 B2 B1 Q2 Q4 S2
B4 A2 B2 B1 Q1 Q3 S1
A1 A2 B2 B1 Q2 Q3 S2
A1 A2 A3 B1 Q2 Q4 S2
I need to first substitute fields 5 & 6, Qn and Qm, with values from the first 4 fields (n and m correspond to the field position).
For example, the first line would become (after substitution)...
A1 A2 B2 B1 A2 B2 S2
Following this, I then need to replace field 7, Sx, with values from fields 5 and 6. Here, if field 7 has a value of 'S1', it would be changed to the value from field 5 and 'S2' would be changed to the value from field 6.
Continuing with the example, the line would further modify to...
A1 A2 B2 B1 A2 B2 B2
Use of awk or sed or any combination thereof or any other method is fine.
Your help is very much appreciated...
Arun