Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I work in at a telecom company and in some cases I need to search for multiple numbers around a specific time. I am using Ubuntu sever 10.04. When I search for a call my normal expression is:

grep 5555551234 20120719-12*

Where 20120719-12* is the date and time (GMT) for the number I am looking for.

When I use

grep 5555551234 20120719-18* | 5555551235 20120719-18*

I will only get a return on the first number

If I use

grep 5555551234 | 5555551235 20120719-18*

I receive -sh 5555551235 not found

Any feedback would be appreciated..

share|improve this question

migrated from Jul 22 '12 at 19:57

This question came from our site for professional and enthusiast programmers.

The pipe character (|) has special meaning to both grep and your shell. Use quoting to make sure the shell passes it to grep unmangled.

share|improve this answer

You will need to use regular expressions.

In your specific case you can use:

grep -E '(5555551234|5555551235) 20120719-18'


  • -E tells grep to use extended regular expressions
  • Don't forget the '
  • Do not put the * in the end of the expression

Just to clarify why you have that error: | is a pipe what basically means sh will redirect the output of the first application to the input of the second, in this case 5555551235, but sh can't find 5555551235, so the error.

share|improve this answer

You must log in to answer this question.