I have a real "headsmasher" on my plate.

I have this piece of script:

```
$lines = Select-String -List -Path $sourceFile -Pattern $pattern -Context 20

foreach ($id in $lines) {

    if (Select-String -Quiet -LiteralPath export.txt -Pattern "$($Matches[1]).+$($id.Pattern)") {

        }

    else {

        Select-String -Path $sourceFile -Pattern $pattern -Context 20 >> $duplicateTransactionsFile

        }
    }

```

but it is not working for me as I wanted it to.

I have two .txt files: "$sourcefile = source.txt" and "export.txt"

The source.txt looks like something like this:

```
Some text here ***********
------------------------------------------------
 F I N A L  C O U N T                  1 9 , 9 9

**************
** [0000123456]
ID Number:0000123456
Complete!
****************!
***********

Some other text here*******
------------------------------------------------
 F I N A L  C O U N T                    9 , 9 9

**********
** [0000789000]
ID Number:0000789000
Complete!
******************!
************

```

The export.txt is like this:

```
0000123456  19,99
0000555555  ,89
0000666666  3,05
0000777777  31,19
0000789000  9,99

```

What I am trying to do is look into source.txt and search for the number that I enter (spaced out in my case)

\**e.g: "9,99" but only that. As you can see, the next number in the source.txt is "19,99" and it also contains "9,99" but I do not want it to be matched.*

and once I find the number, look for the next line in the source.txt that contains the text "ID Number:" then get the numbers right after the ":" Once I get those numbers after the ":", I want to now look into the export.txt and see if the numbers after the ":" are there and whether it has the "9,99" on the same line next to it but exactly "9,99" and nothing else lie "19,99", "29,99", and so on.

Then the rest is easy:

```
if (*true*) {
do this
}

else {
do that
}

```

Could you guys give me some love here and help a brother out?
I very much appreciate any help or hint you could share.

Best of wishes!