OT: Need some shell scripting hints

Nir Soffer yellowdog-general@lists.terrasoftsolutions.com
Thu Oct 2 09:50:06 2003


I would rather use Python for this. Here is a 5 lines script (including 
documentation):

	#!/usr/bin/env python
	"""lines.py - do somthing with lines from files in the command line, 
or stdin"""

	import fileinput

	for line in fileinput.input():
		# do something with line


Actually it works like the cat command, you can use it to do something 
with the lines of several files, like:
	% lines.py file1 file2 ... fileN > output

and you can also pipe data through the command:
	% command1 | lines.py | command2