#!/usr/bin/perl if ($ARGV[0] eq 'help') { #Documentation print ' populate a set of directory with files containing path informations run_putdir N Dir_root file1 populate the N directories Dir_rooti (i=1,N) by file1, and if file1 contains a line containing cd replace the line by cd ..../Dir_rooti example: run_putdir 50 NODE_ run.vasp Usefull for some schedulers ' } else { open (FICHIER1, $ARGV[2]); @map1 = ; #print @map1; $diro = `pwd`; chop($diro); #-------------------------------------------------------- for($i=1; $i<=$ARGV[0]; $i++) { $nam0=$ARGV[1].$i; chdir ($nam0); @mapout=(); foreach $lign1 (@map1) { if ($lign1=~ m/cd/) { push (@mapout,'cd '.$diro.'/'.$nam0."\n"); } else { push (@mapout,$lign1); } } open (FICHIER2, ">$ARGV[2]"); print FICHIER2 @mapout; chdir (".."); close(FICHIER2); } }