Have a very simple powershell script to count the number of trades in a file:
(gc \\mimkeimc11n\Batch\FundQuest\TradeFiles\trades.dat |? {$_ -match 'SL|BY'} | Measure-Object | select count).count > \\mimkeimc11n\Batch\FundQuest\ConfirmtoFQ\NumberofTrades.txt
The problem I am running into is the output NumberofTrades.txt is including the number that I want, but also a CR LF, not sure why??? Any help would be greatly appreciated.

PowerShell is pretty persistent about outputting newlines for you when you send strings to Out-File (alias >) or even Add/Set-Content. It can be infuriating sometimes and makes me wish for a -NoNewLine parameter on these cmdlets. For now you can use a .NET API e.g.: