以下は、ファイルのテキストブロックの例です。
Now is the time for all blah:1; to come to the aid
Now is the time for all blah:1; to come to the aid
Now is the time for all blah:1; to come to the aid
Now is the time for all blah:10; to come to the aid
Go to your happy place blah:100; to come to the aid
Go to your happy place blah:4321; to come to the aid
Go to your happy place blah:4321; to come to the aid
Now is the time for all blah:4321; to come to the aid
Now is the time for all blah:9876; to come to the aid
Now is the time for all blah:108636; to come to the aid
Now is the time for all blah:1194996; to come to the aid
Q:「is the」を含む行からすべての一意の番号を抽出する方法は?
'を使ってみましたgrep -o -P -u '(?<=blah:).*(?=;)
が、セミコロンが好きではありません。
ベストアンサー1
\K
ちょうど一致したものを忘れるための指示を探しています。
grep -oP 'is the.*?blah:\K\d+'
それからsort -u