All, 

my goal will look like this:

-w 'barcode="E00085" or barcode="E00086" or barcode="E00096" or 
barcode="E00184"
-w 'barcode="E00293" or barcode="E00351" or barcode="E00524" or 
barcode="E00584"
-w 'barcode="E00587" or barcode="E00588" or barcode="E00589" or 
barcode="E00654" 
-w 'barcode="E00876" '

I will have a file that contains anywhere from 1-40 strings, but I would 
like 4 E strings per line then a \n

I started with this code to give me a visual representation:

 
#!/usr/local/bin/perl -w
use strict;
my @src = 1..8;
my $count = 0;
while ( my @position = splice( @src, 0, 4) ) {
print join( "\t", @position ), "\n";
$count += @position;
print "\n";
}

which outputs 

        1       2       3       4

        5       6       7       8

so if I have a flat file that looks like:

E00085
E00086
E00096
E00184
E00245

how do I get to as the above goal?

My orginal code is this:

## Set Pragmas

use strict;
use MIME::Lite;

## Declare variables, set scaler ^I(rw to same file), init array, create 
filehandles and p
arse data

local $ENV{'PATH'} = qq(/usr/epoch/bin:/usr/epoch/EB/bin:/bin:/usr/bin);
my @ejectapes = qq(/usr/local/bin/perld/derektapes);
($^I, @ARGV) = ('.bak', @ejectapes);
open (FILE, "<@ejectapes") or die "cannot open file: $!\n";
open (FILEOUT, ">/tmp/ejects.out$$") or die "failed to open eject.out: 
$!\n";
my $ejects = "/tmp/ejects.out$$";
print FILEOUT "eject 0,0,0 ";
my $count = `wc -l <@ejectapes`;
if ($count <= 40 ) {
 
        foreach (<FILE>) {
                chomp $_;
                print FILEOUT "$_ ";
        }
close (FILEOUT);
print "\n";
print "Number of lines are: $count \n";

                #`evmeject -r $_`;
                #`evmeject -l offsite_0 -b$_`;
} else {
                my $msg = MIME::Lite->new(
                From    => 'EDM01 <[EMAIL PROTECTED]>',
                To      => 'Derek Smith <[EMAIL PROTECTED]>',
                Subject => "Eject list is greater than 40",
                Data    => "@ejectapes" );
                $msg->send;
}
close (FILE);

__ END __



thanks!

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams

Reply via email to