At Thursday 25/1/2007 01:25, NoName wrote:
perl -ane "print join(qq(\t),@F[0,1,20,21,2,10,12,14,11,4,5,6]).qq(\n)"
Must be done on a single line?
I'm not sure if I've got right the behavior - it's been some time
since I quit writing Perl code. The script iterates over all lines
contained on all files specified on the command line; for each line,
splits it on whitespace; then it prints a selected set of fields
(columns 0, 1, 20, 21...) using a tab character as field separator.
=== cut ===
import operator,fileinput
mapper = map(operator.itemgetter, [0,1,20,21,2,10,12,14,11,4,5,6])
for line in fileinput.input():
fields = line.split()
print '\t'.join(m(fields) for m in mapper)
=== cut ===
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
--
http://mail.python.org/mailman/listinfo/python-list