Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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
See the Bash Wiki on quoting... – jasonwryan May 26 '14 at 0:42

1 Answer 1

grep -E "^.{11,22}$Name" emplist
share|improve this answer

Your Answer


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.