Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
A と B のみを含むすべての行を取得するために egrep を書きたいのですが、A の出現回数は 4 で割り切れます!
これでうまくいくと思います:
egrep '^((B*A){4})+B*$' filename
(B*A)は、任意の数の B の後に A が続くものと一致します。{4}このシーケンスが 4 回出現する必要があります。それをグループ化して追加すると+、これらの 4-A グループの複数の発生が可能になります。次にB*、最後に行にいくつかの追加の B を許可します。
(B*A)
{4}
+
B*