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

おすすめ記事