Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$dirtoget = "/tmp/invs"; opendir(FILEDIR, $dirtoget) || die ("Cannot open $dirtoget"); @thefiles = grep -T, <$dirtoget/*>; #Store the filenames into an arra +y closedir(FILEDIR); #Calling another perl script that takes each filename as argument #and splits the file into multiple files for further processing foreach $file (@thefiles) { @split_files = `perl split_invs.pl $file`) || next; chomp(@split_files); $temp = join(" ", @split_files); `/tmp/get_acct_info.sh $temp`; #This script takes each split file and + reads some information & #outputs the info to the file output_acct_list.out #Load the main accounts file into a hash to compare against another fi +le #and output accounts only in output_accts_list $origaccts = "/tmp/main_accounts.txt"; open(FILEHANDLE, $origaccts) || die ("Cannot open $origaccts"); %lookup = map {chomp; $_ => undef} <FILEHANDLE>; close(FILEHANDLE); $acctlist = "/tmp/output_acct_list.out"; #Open the file output_acct_li +st for reading open(ACCTLISTFILE, $banlist) || die ("Cannot open $acctlist"); #Output file that will contain filename of the bills that should be lo +aded into our system open($output, '>', '/tmp/invs_load.txt') || die ("Cannot open output file /tmp/invs_load.txt"); while ($line = <ACCTLISTFILE>){ chomp $line; ($filename, undef, undef, undef, $account) = split /\t/, $line; next if exists $lookup{$account}; print $output "$filename\n"; #Print the filename of bills to be lo +aded to invs_load.txt } <Here I want to retrieve the filenames from the above file and append +these files (in order) into a single file prior to loading it into ou +r system> }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: appending files
by BrowserUk (Patriarch) on Jan 03, 2006 at 22:30 UTC | |
by Anonymous Monk on Jan 04, 2006 at 02:28 UTC | |
by BrowserUk (Patriarch) on Jan 04, 2006 at 05:26 UTC | |
|
Re: appending files
by smokemachine (Hermit) on Jan 03, 2006 at 22:49 UTC |