Just to elaborate the answer from @Deepesh, here is an example, how you can accomplish your goal.
1) save a list of tables you want to drop into a file
echo "show tables like 'test_*';" > tables.sql
beeline -u 'jdbc:hive2://localhost:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -f tables.sql > tables.txt
2) from this list, generate a list of drop tables commands; for example, you can use the following python script, generate_droptables.py:
f = 'tables.txt'
f = open(f)
lines = f.readlines()
def process_line(line):
if line.startswith('|') and 'test_' in line:
return line[1:].strip()[:-1].strip()
names = list(map(process_line, lines))
names = list(filter(lambda x : x, names))
out = open('droptables.sql', 'w')
for item in names:
out.write("drop table %s;\n" % item)
3) run the list drop tables command
python generate_droptables.py
beeline -u 'jdbc:hive2://localhost:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -f droptables.sql