com paste
sob bash você pode fazer:
paste <(cut -f 4 1.txt) <(cut -f 4 2.txt) .... <(cut -f 4 20.txt)
Com um script python e qualquer número de arquivos ( python scriptname.py column_nr file1 file2 ... filen
):
#! /usr/bin/env python
# invoke with column nr to extract as first parameter followed by
# filenames. The files should all have the same number of rows
import sys
col = int(sys.argv[1])
res = {}
for file_name in sys.argv[2:]:
for line_nr, line in enumerate(open(file_name)):
res.setdefault(line_nr, []).append(line.strip().split('\t')[col-1])
for line_nr in sorted(res):
print '\t'.join(res[line_nr])