tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Jean Schuller <schuller () crnal4 ! in2p3 ! fr>
To: tru64-unix-managers
Subject: SUMMARY : PERL Problem
Date: Wed, 19 Mar 1997 09:45:33 +0000	[thread overview]
Message-ID: <96078609810482.tru64-unix-managers.marc@archive.invalid> (raw)


Hi all,

Many thanks for all the good and efficient hints .. You're great.


Special thanks to : (WHAT A LIST !!!!!!!!)
Geert Jan Bex=20
Paul A Sand
Dan Peters=20
Dan Rosenthal
Roy Rapoport
Juan Gallego
Lance A. Brown=20
Jean-Loup Risler
John K. Peterson =20
James Michaud
Anthony Talltree=20
Hans Kowallik
Eric Pettersen
Lam Tak Ming
Ben Goodwin
Stavros A. Papadak
Ollivier Robert

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D

My problem :
>When I execute my script :
>#!/usr/local/bin/perl
>print "Start of splitting main file\n";
>system("split -100 FINAL.LISTE_SORTED SORTIX.");
>print "Main file splitted\n";
>@list =3D `ls SORTIX* `;
>print "SORTIX List created\n";
>$rank=3D0;
>foreach $li (@list)
>{
>  print "I read ",$li," I write ",$outfile,"\n";
>  $rank++;
>  $outfile=3D"SORTIX".$rank;
>  system("mv $li $outfile");
>}
>.
>.
>.
>I have each time an error message :
>Start of splitting main file
>Main file splitted
>List with SORTIXn created
>I read SORTIX.aa
> I write SORTIX1
>usage: mv [-i | f] [--] src target
>.
>.
>.


The solution(s) :

-------------------------------------------------------
use Perl's 'rename' instead?
-------------------------------------------------------
use @list =3D <SORTIX*>;
-------------------------------------------------------
use system(`mv $li $outfile`);
-------------------------------------------------------

        Your big problem here is that you have not removed line returns
from your array elements.  The way to fix your script is to add
chomp $li;
-------------------------------------------------------
   chop $li;
-------------------------------------------------------
ather than doing:
@list =3D `ls SORTIX* `;
I would try
@list=3D<SORTIX*>;

and why not
rename($li,$outfile);
rather than
system(....)
-------------------------------------------------------
$outfile=3D"SORTIX.$rank";
Also, use rename() instead of spawning an mv invocation.
-------------------------------------------------------


JEAN




-------------------------------------------------------------------------=
----
Jean Schuller                    _/  _/_/_/    _/_/_/  _/_/_/_/
schuller@crnal4.in2p3.fr        _/  _/    -/  _/  _/  _/    =20
                               _/  _/_/_/-/  _/_/_/  _/_/_/_/
                              _/  _/   -/   _/            _/
                             _/  _/    _/  _/_/_/  _/_/_/_/ =20
local   call:    0388106630    Institut de Recherches Subatomiques
foreign call: (33)388106630    Bo=EEte Postale 28=20
local   fax :    0388106234    23, Rue du Loess
foreign fax : (33)388106234    F-67037 STRASBOURG CEDEX  - France
-------------------------------------------------------------------------=
----

             reply	other threads:[~1997-03-19  9:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-19  9:45 Jean Schuller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-04-18 13:12 SUMMARY: Perl problem kat
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox