Utilities

From LeoWiki

Jump to: navigation, search

Find in Files

If you are silly like me, and want to approximate grep 'phrase' * without using it, you can do list -1 | sanecat | grep 'phrase' where sanecat is the following Python script:

#!/usr/bin/python

import sys;

for filename in sys.stdin:
	# identify the file
	sys.stderr.write(filename);
	sys.stderr.flush();
	
	# drop the \n
	filename = filename[:-1];
	
	# print contents
	for line in open(filename):
		sys.stdout.write(line);
	sys.stdout.flush();
Personal tools