Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

In the following command sequence,

 $ grep -E '^.{11,22}John' emplist 
 Operations John Thompson  PARTHawks        Cher           
 Sales      John Jacobs    FULLHawks        Davinder Singh 
 Finance    Dean Johnson   FULLVegans       Sandeep Jain   
 $ Name=John
 $ grep -E '^.{11,22}$Name' emplist 
 $ 

I want the output of

grep -E '^.{11,22}$Name' emplist

to be the same as the output of

grep -E '^.{11,22}John' emplist 
share|improve this question
2  
See the Bash Wiki on quoting... – jasonwryan May 26 '14 at 0:42
Name=John
grep -E "^.{11,22}$Name" emplist
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.