grep 및 명령줄 변수 대체

grep 및 명령줄 변수 대체

다음 명령 순서에서는

 $ 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 
 $ 

내가 원하는 출력

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

출력과 동일

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

답변1

Name=John
grep -E "^.{11,22}$Name" emplist

관련 정보