after executing grep '19-12-2008 without ending the quote.i got stuck with > in command line how to exit


End it by closing your quote (i.e. typing another apostrophe).

Or, if you've changed your mind and you don't want to execute the command any more, ctrlc will get you out of the command and back into the shell.

| improve this answer | |

Just CTRL-C and start again, or type in 'ENTER on the next line. The prompt you're seeing (>) is because you haven't finished the command - the shell thinks you wanted that linefeed within a string and it's waiting for you to close that string with another quote.

| improve this answer | |
  • At least with bash/grep, it's not treating the linefeed as a literal. echo -en hi | grep 'h ' (with single or double quotes, and with newlines instead of spaces) both pick up the hi. If you actually put spaces in the quotes, it does not pick up the hi. – Mark Rushakoff Oct 21 '09 at 11:27
  • Interesting, that must be a grep feature - it works with grep 'h<lf>i' but echo outputs it as I expected, with an embedded linefeed. – paxdiablo Oct 21 '09 at 12:15

escape your quotation mark with a backslash

$ grep \'19-12-2008
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy