1. Create a file (say cquery.txt) with any cassandra queries.. For ex. given below
use system; select * from schema_keyspaces;
2. Run either of the following commands to achieve desired output
<cassandra_home>/bin/cqlsh -f cquery.txt > cquery.out <cassandra_home>/bin/cqlsh --file=cquery.txt > cquery.out