Prev: MinGW and Perl 5.12 - Windows 64 bits ActiveState
Next: FAQ 9.24 How do I fetch a news article or the active newsgroups?
From: joinerda on 14 May 2010 14:35 I would like to use a perl format statement to autogenerate qsub files for a PBS scheduler. The files I need to generate are essentially shell scripts with comments beginning with a hash mark to denote them as pragma for the scheduler. If I create a format statement that looks like format QSUBFILE = #PBS -N @<<<<<<<<< $queue .. the line beginning with a hash mark is read as a comment by PERL, instead of a line that needs to be printed that starts with a hash mark. How can I using a PERL format statement generate a number of files all of which has as their first few lines variations of #PBS -N dustfit #PBS -q default #PBS -l nodes=1:ppn=8 #PBS -l cput=6000:00:00
From: Ralph Malph on 14 May 2010 14:55 On 5/14/2010 2:35 PM, joinerda wrote: > I would like to use a perl format statement to autogenerate qsub files > for a PBS scheduler. The files I need to generate are essentially > shell scripts with comments beginning with a hash mark to denote them > as pragma for the scheduler. > > If I create a format statement that looks like > > format QSUBFILE = > #PBS -N @<<<<<<<<< > $queue > . The easiest option is to just add a leading space before the # format QSUBFILE = #PBS -N @<<<<<<<<< $queue . will end up printing exactly what you want but the first column will be empty.
From: arus on 14 May 2010 15:02 On 5/14/2010 2:35 PM, joinerda wrote: > I would like to use a perl format statement to autogenerate qsub files > for a PBS scheduler. The files I need to generate are essentially > shell scripts with comments beginning with a hash mark to denote them > as pragma for the scheduler. > > If I create a format statement that looks like > > format QSUBFILE = > #PBS -N @<<<<<<<<< > $queue > . Put the hashmark in a variable Eg) my $hm="#"; format QSUBFILE = @#PBS -N @<<<<<<<<< $hm,$queue . Best Regards, Adam
From: arus on 14 May 2010 15:04 On 5/14/2010 3:02 PM, arus wrote: > On 5/14/2010 2:35 PM, joinerda wrote: >> I would like to use a perl format statement to autogenerate qsub files >> for a PBS scheduler. The files I need to generate are essentially >> shell scripts with comments beginning with a hash mark to denote them >> as pragma for the scheduler. >> >> If I create a format statement that looks like >> >> format QSUBFILE = >> #PBS -N @<<<<<<<<< >> $queue >> . > Put the hashmark in a variable > Eg) > my $hm="#"; > format QSUBFILE = > @#PBS -N @<<<<<<<<< > $hm,$queue > . I forgot to delete your original #. Please correct that to read Eg) my $hm="#"; format QSUBFILE = @PBS -N @<<<<<<<<< $hm,$queue ..
From: joinerda on 14 May 2010 15:30
I thought about that, but the file has a space in the line that breaks the way the file is parsed by the scheduler. I need the first character of the line to be a hash. I can do this with print or printf statements easily enough, but I am trying to come up with a solution where the format statement looks as much as possible like the files my end-users (who tend to ask things like "what is backslash n again?") are used to dealing with so that this is easier to do in the future. On May 14, 2:55 pm, Ralph Malph <ra...(a)happydays.com> wrote: > On 5/14/2010 2:35 PM, joinerda wrote: > > > I would like to use a perl format statement to autogenerate qsub files > > for a PBS scheduler. The files I need to generate are essentially > > shell scripts with comments beginning with a hash mark to denote them > > as pragma for the scheduler. > > > If I create a format statement that looks like > > > format QSUBFILE = > > #PBS -N @<<<<<<<<< > > $queue > > . > > The easiest option is to just add a leading space before the # > format QSUBFILE = > #PBS -N @<<<<<<<<< > $queue > . > > will end up printing exactly what you want but the first column will be > empty. |