To achieve this task Neo4j shell can be used. Imagine that you want to import following file:
CREATE (:Somebody); MATCH (s:Somebody) CREATE (s)-[:LIVE]->(:Europe);
To execute these 2 queries directly from command line, we can execute this:
./neo4j-shell -file sample.txt > result.txt
The output printed to result.txt file should resume queries execution against database:
+-------------------+ | No data returned. | +-------------------+ Nodes created: 1 Labels added: 1 55 ms +-------------------+ | No data returned. | +-------------------+ Nodes created: 1 Relationships created: 1 Labels added: 1 58 ms