I am still lost. I have been reading a lot and still haven't figured it out. "It seems" the solution is to use array (that alone is a can of worms!!!). I went thru many different samples and tutorials and I just can't make it work. Here is how my files are...
file1.txt:
110724
110725
file2.txt:
11:52:10 688 DMN: MSG 110722 Accepted connection: [172.31.35.203] (dc-1044a.central.nychhc.org)
11:52:10 688 DMN: MSG 110722 SMTP session ended: [172.31.35.203] (dc-1044a.central.domain.com)
11:52:13 688 DMN: MSG 110723 Accepted connection: [172.31.35.203] (dc-1044a.central.domain.com)
11:52:13 688 DMN: MSG 110723 SMTP session ended: [172.31.35.203] (dc-1044a.central.domain.com)
11:52:21 488 IMAP4 session ended: 172.23.75.28
11:52:28 688 DMN: MSG 110724 Accepted connection: [172.21.109.179] (160-9fl-fl.central.domain.com)
11:52:28 688 DMN: MSG 110724 Refused sender:
email1@domain1.com (4)
11:52:28 688 DMN: MSG 110724 SMTP session ended: [172.21.109.179] (160-9fl-fl.central.domain.com)
11:52:28 688 DMN: MSG 110725 Accepted connection: [172.17.228.250] (kchc-sob265-pc6.kchdomain.local)
11:52:28 688 DMN: MSG 110725 Refused sender:
email2@domain2.com (4)
11:52:28 688 DMN: MSG 110725 SMTP session ended: [172.17.228.250] (kchc-sob265-pc6.kchdomain.local)
Now, how I want my output file (file3.txt):
11:52:28 688 DMN: MSG 110724 Accepted connection: [172.21.109.179] (160-9fl-fl.central.domain.com)
11:52:28 688 DMN: MSG 110724 Refused sender:
email1@domain1.com (4)
11:52:28 688 DMN: MSG 110724 SMTP session ended: [172.21.109.179] (160-9fl-fl.central.domain.com)
11:52:28 688 DMN: MSG 110725 Accepted connection: [172.17.228.250] (kchc-sob265-pc6.kchdomain.local)
11:52:28 688 DMN: MSG 110725 Refused sender:
email2@domain2.com (4)
11:52:28 688 DMN: MSG 110725 SMTP session ended: [172.17.228.250] (kchc-sob265-pc6.kchdomain.local)
Now, I tried awk with while getline, if i++, and variants and can't get it to work. I even tried perl.
Anyone to shed a light, please?