*nix コマンドラインでは、grepがあります (実装によって若干異なります)。GNU/grep では、最初の一致で停止する "-m" スイッチがあります。
$ grep Test log.txt | grep -m1 'Source 192.168.0.1 Port 23 Destination 192.168.0.2 Port 23'
-10-30-123-012-031-22 Test Source 192.168.0.1 Port 23 Destination 192.168.0.2 Port 23 djlkdj
たとえば、ログファイルで「テスト」を検索し、特定の部分のみを処理するには、ログファイルをsedで「クリーン」にするのが好きです。
$ grep Test log.txt | sed 's/.*Test/Test/;s/ djlkdj$//' | sort | uniq -c
4 Test Source 192.168.0.1 Port 23 Destination 192.168.0.2 Port 23
2 Test Source 192.168.0.1 Port 23 Destination 192.168.0.222 Port 25
4 Test Source 192.168.0.1 Port 25 Destination 192.168.0.2 Port 23
2 Test Source 192.168.5.1 Port 23 Destination 192.168.0.2 Port 23
これがあなたが望んでいたものかどうかはわかりません。