Alex Rivera | Logout

Grep with quotation mark

Asked 2011-08-04T18:30:14.120
15

I'm trying to scan an error log for lines with 503 errors, so I'm grepping for " 503 (quote space 503).

This seems simple, but it won't work:

grep '" 503 ' access.log

I get the following error:

bash: -c: line 0: unexpected EOF while looking for matching `"' bash: -c: line 1: syntax error: unexpected end of file

Edit
Report

1 Answer

1

I believe I have it working now (not sure because I got no results, but didn't get an error).

The reason is because I'm passing it through an ssh command like the following and I believe SSH is doing some escape trickery:

ssh 123.123.123.123 grep '" 503 ' access.log

Modifiying it to this seems to be the fix:

ssh 123.123.123.123 "grep '\" 503 ' access.log"

Thanks for everyone's time.

answered 2011-08-04T18:42:52.470

Your Answer