import re, sys for line in open(sys.argv[1]): if re.findall('"(.*?)"', line): print ' '.join(re.findall('"(.*?)"', line))