例えば:
file.txtに含まれるもの
this is a string
this is another string
grep "this is" file.txtは次のように出力する必要があります。
a string
another string
GNU grepを使用している場合は、この(?<=)
「後読み」を使用すると機能するはずです。
$ echo -e "this is a string\nthis is another string"
this is a string
this is another string
$ echo -e "this is a string\nthis is another string" | grep -Po '(?<=this is).+'
a string
another string
ここにいくつかの正規表現の先読みと後読み情報
またはを使用して sed
sed 's/this is//'
または
sed -n 's/this is//p'
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加