Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello!
Very new to awk I need to do the following...
I have one file looking like this:
Probe "AFX_1234_at1"
Probe "AFX_554545_at1"
Probe "AFX_34342_at2"The I have another file looking like that:
Probe_set "AFX_1234_at"
Signal "AFX_3336" 125Probe_set "AFX_554545_at"
Signal "AFX_3336" 554Probe_set "AFX_34342_at"
Signal "AFX_3336" 88.2And I would need to build a file looking like this:
Probe "AFX_1234_at1"
Signal "AFX_3336" 125Probe "AFX_554545_at1"
Signal "AFX_3336" 554Probe "AFX_34342_at2"
Signal "AFX_3336" 88.2In other words, I need to have the Probe_set of file 2 replaced by the correponding Probe from file 1, and I need to keep the Signal line.
Thanks a lot for your inputs!
newtoallthis

A very rough sketch:
1. In your BEGIN block, open and read the first file. Create a dictionary (associative array) by splitting e.g. "AFX_1234_at1" (using substring functions) into "AFX_1234_at" and "1", and put these into an associative array like probe["AFX_1234_at"] = "1".
2. Treat the second file as your main input.
/Probe_set/ {
print "Probe" $1 probe[$1]
}
/Signal/ {
}(I haven't tested the above code; you'll have to try it out yourself and fix it.)

![]() |
Slight inaccuracy Roundin...
|
append creation date to f...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |