[system] / trunk / webwork / system / scripts / columnPrint.pl Repository:
ViewVC logotype

View of /trunk/webwork/system/scripts/columnPrint.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (download) (as text) (annotate)
Mon Jun 25 18:20:05 2001 UTC (18 years, 5 months ago) by sam
File size: 1397 byte(s)
Removed unneeded scripts (as per discussion with gage, apizer). Added
BEGIN-block method for library inclusion to command-line scripts.

    1 #!/usr/local/bin/webwork-perl
    2 
    3 ## $Id$
    4 
    5 BEGIN {
    6   my $useLibDir = '.';
    7   if    ($0 =~ m|^(/.*)/|)  { $useLibDir = $1; }
    8   elsif ($0 =~ m|^(\..*)/|) { $useLibDir = $1; }
    9   elsif ($0 =~ m|^(.+)/|)   { $useLibDir = "./$1"; }
   10   unshift @INC, $useLibDir;
   11 }
   12 
   13 use webworkInit; # WeBWorKInitLine
   14 use Global;
   15 
   16 # This file is   columnPrint.pl  Note: warning messages given by -w switch can safely be ignored AKP 8/20/96
   17 
   18 # Call with command arguments of the form:   inputFile outputFile
   19 
   20 
   21 if (@ARGV != 2)
   22   {print "\nSyntax is columnPrint.pl inputFile.ext outputFile.ext \n";
   23    print "      (e.g. columnPrint.pl 140atotal.csv 140atotal.csv ) \n\n";
   24    exit(0);
   25   }
   26 # Takes two command line arguments.
   27 # The first is the full file name of the
   28 # delimited input file.  The second is the full file name of the
   29 # output file (these names may be the same).
   30 
   31 # This script takes any delimited (with \$DELIM delimiters) file and adds
   32 # extra space if necessary to the fields so that all columns line up.
   33 # The widest field in any column will contain exactly 2 spaces at the
   34 # end of the (non space characters 0f the) field. For example
   35 # ",a very long field entry  ," at one extreme and  ",  ," at the other
   36 # assuming that \$DELIM = ","  .
   37 
   38 
   39 local($fileName1,$fileName2) = @ARGV;
   40 
   41 $scriptDirectory   = $Global::scriptDirectory;
   42 require "${scriptDirectory}$Global::FILE_pl";
   43 
   44 &columnPrint ($fileName1,$fileName2);

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9