grep
принимает \(
в качестве начала группы захвата.Просто отбросьте \
из (
и )
.
$ echo "[27 May 2019 23:42:32,418] [Accept-Nsh-Proxy-Thread] [ERROR] [::] [Appserver] Too many open files (Accept failed)" | grep -i "\[Appserver\] Too many open files (Accept failed)"
[27 May 2019 23:42:32,418] [Accept-Nsh-Proxy-Thread] [ERROR] [::] [Appserver] Too many open files (Accept failed)
или используйте переключатель grep -F
.Это заставляет grep анализировать аргумент буквально, поэтому вы можете забыть о экранировании:
$ echo "[27 May 2019 23:42:32,418] [Accept-Nsh-Proxy-Thread] [ERROR] [::] [Appserver] Too many open files (Accept failed)" | grep -i -F "[Appserver] Too many open files (Accept failed)"
[27 May 2019 23:42:32,418] [Accept-Nsh-Proxy-Thread] [ERROR] [::] [Appserver] Too many open files (Accept failed)