# Copyright 2009 Chirag Shah # Script to read a list of text files and combine them in TREC format. # Usage: ./combineDocs.pl < #!/usr/bin/perl open(FILELIST, $ARGV[0]) || die "Error reading the input file.\n"; open(OUTFILE, ">documents.txt") || die "Error creating the output file.\n"; $docNo = 1; while ($docName = ) { print OUTFILE "\n$docNo\n\n"; open (INFILE, $docName); while ($line = ) { print OUTFILE $line; } close(INFILE); print OUTFILE "\n\n"; $docNo++; } close(FILELIST); close(OUTFILE);