in reply to Loop is not working
Consider a simple read/write loop to customise your template
poj#!/usr/bin/perl use strict; use warnings; # do second level statistical analysis run by run # go to the directory where the fsf-file for stats # and post-stats is stored chdir "/mnt/hgfs/ExpAutism/Scripts"; my $infile = 'Level1Run1.fsf'; my $outfile = 'Level1Run1_spec.fsf'; my $program = '/usr/local/fsl/bin/feat'; my @subjects = ("SubjectASD202","SubjectASD203"); foreach my $subject (@subjects){ open my $fh_IN, '<', $infile or die "Could not open $infile ; $!"; open my $fh_OUT, '>', $outfile or die "Could not open $outfile ; $!"; # replace wildcards with specific titles of subjects while (<$fh_IN>){ s/Subjectx/$subject/g; print $fh_OUT $_; } close $fh_IN; close $fh_OUT; system($program,$outfile) == 0 or die "$program $outfile failed: $?"; } print "\n +++ DONE +++ \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Loop is not working
by ozdemmer (Novice) on Oct 03, 2018 at 22:03 UTC | |
by Marshall (Canon) on Oct 04, 2018 at 01:14 UTC | |
by haukex (Archbishop) on Oct 04, 2018 at 07:24 UTC | |
by haukex (Archbishop) on Oct 04, 2018 at 07:15 UTC | |
by NetWallah (Canon) on Oct 03, 2018 at 23:35 UTC | |
by stevieb (Canon) on Oct 03, 2018 at 23:16 UTC |