in reply to Re^2: Perl to run 2 files and print the third with loop
in thread Perl to run 2 files and print the third with loop
Was thinking about this a bit, and it seems based on the data we have been given by EBK, that the timestamps really don't matter at all. Perhaps if we could see the entirety of File B, this would be cleared up.
That being said, here is a more simple (or perhaps more cryptic) solution which doesn't rely on storing all of File B in memory:
#!/usr/bin/perl -wlaF, BEGIN { open FH, '<', 'FileB' } print "Loop tot-> $F[4]"; for ( 1 .. $F[4] ) { @G = split ',', <FH>; print join ',', $F[0], $G[0], $F[2]; }
If you save this script as 'run.pl', you can call it like so:
chmod 740 run.pl ./run.pl <FileA
The -a option turns on autosplit mode and the -F, option sets the field delimiter to a comma.
EBK, I'm curious to know whether this will work for you. Please let me know!
Best,
Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl to run 2 files and print the third with loop
by EBK (Sexton) on Apr 02, 2018 at 17:29 UTC |