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.
いくつかの「+」文字の後にいくつかの「-」文字を出力しようとしていますが、繰り返しの数はいくつかの単純な算術によって決定されます。次の問題点を教えてください(これは分割を試みなくても機能します)。
some-command | perl -pe 's/(\d+) (\d+)/ "+" x ($1 / 4) . "-" x ($2 / 4)/eg'
/逃げる必要があります。試す:
/
some-command | perl -pe 's/(\d+) (\d+)/ "+" x ($1\/4) . "-" x ($2\/4)/eg'
/別のオプションは、正規表現とは異なる文字を使用することです。
some-command | perl -pe 's;(\d+) (\d+); "+" x ($1/4) . "-" x ($2/4);eg'