インフラエンジニアの技術ブログ

日々学んでいることをブログでまとめていきます。

備忘_丸括弧を含む文字列を探す

()各々の前にバックスラッシュ\を入れて()を記号として認識させる

[root@centos]# cat /etc/redhat-release
CentOS release 6.9 (Final)

[root@centos]# cat regular.log
(regu)lar

grepで検索できたパターン
[root@centos]# cat regular.log |grep \(regu\)
(regu)lar

\を入れない場合はエラー発生
[root@centos]# cat regular.log |grep (regu)
-bash: 期待してない token `regu' のあたりにシンタックスエラー