title: Redis mass insertion do not work
body: <p>Problem as simple as I want to do mass insertion in redis using a file and redis-cli in pipe mode. Redis documentation explains this here: <a href="http://redis.io/topics/mass-insert" rel="nofollow noreferrer">http://redis.io/topics/mass-insert</a> </p>
  
  <p>My file contains only this command:</p>
  
  <pre><code>HMSET client:1 name "Michael"
  </code></pre>
  
  <p>When I try it in my shell (Ubuntu Linux):</p>
  
  <pre><code>cat data.txt | redis-cli --pipe
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>ERR unknown command '$4'
  ERR wrong number of arguments for 'echo' command
  ERR unknown command '$20'
  </code></pre>
  
  <p>I've seen that other users have same problem (<a href="https://stackoverflow.com/questions/13195341/how-to-use-redis-mass-insertion">How to use Redis mass insertion?</a>) but I haven't found a good solution. </p>
  
  <p>Any help would be appreciated.</p>
  
  <p><strong>UPDATE: SOLUTION</strong></p>
  
  <p>Finally the best option for me was to use a redis client developed in Python. This is a 
  pretty straight forward solution, and the point is that we don't need to use/code redis protocol directly.</p>
  
  <p>I choose redis-py client (<a href="https://github.com/andymccurdy/redis-py" rel="nofollow noreferrer">https://github.com/andymccurdy/redis-py</a>). After installing it you can import its functionality in your python script. This is an example of how my script does the job:</p>
  
  <pre><code>import redis
  
  # Connection to 0 database (default in redis)
  r = redis.Redis(host="localhost",db=0)
  
  # inserting client hashmaps
  r.hmset('client:1', {'name':'John', 'company':'Microsoft'})
  r.hmset('client:2', {'name':'James', 'company':'Apple'})
  
  # inserting a list of domains for client 1
  r.rpush('client:1:domains','www.microsoft.com','www.msn.com')
  
  #to print values in stdout
  print(r.hgetall('client:1'))
  </code></pre>