Sponsored Content
Top Forums Shell Programming and Scripting How to create a variable without multiple concats in a perl scripts that makes a bsub? Post 302976744 by jdilts on Tuesday 5th of July 2016 11:15:26 AM
Old 07-05-2016
Facebook How to create a variable without multiple concats in a perl scripts that makes a bsub?

The red text at the bottom represents the three lines I want to address.
I'm dynamically creating a bsub with a perl script and would like to create the
Code:
fasta_16S

variable in a single line....not three. I'm having difficulty in getting the syntax correct. Obviously, there is some confusion because I'm creating a script in a script.

Code:
#!/usr/bin/perl -w


use strict;
use File::Slurp;
use Data::Dumper;




my ($dir,$plugin,$MIN_READ_LENGTH_16S) = @ARGV;
my $microbiome_sample_id_list = $dir . "/sample_ids_of_microbiome_samples.csv";
my $DB="/mnt/Lab/Data/IonTorrent/plugins/" . $plugin . "/db/MB_DB.udb";
my @file = read_file($microbiome_sample_id_list);
my $sample_num = scalar @file;
my $path = "/mnt/Lab/Data/IonTorrent/$server/$run";





open BSUB,">$dir/MB.bsub" || die $!;

       print BSUB "\#!/bin/bash\n

                   \#BSUB -J MBSAMPLE\[1-$sample_num\]
                   \#BSUB -o $path/MBSAMPLE.out
                   \#BSUB -e $path/MBSAMPLE.err\n


                   id=(`sed -n \"\$LSB_JOBINDEX\"p $path/sample_ids_of_microbiome_samples.csv`)

                   fasta_16S=$path/\${id}/\${id}_bacterial_minreadlen
                   fasta_16S+=$MIN_READ_LENGTH_16S
                   fasta_16S+=.fasta

              ";

close(BSUB);

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

usage of same variable in multiple scripts

Hi, I have a .test file which has: #!/bin/ksh export TEST_FLAG=1 In the test1.ksh i have: #!/bin/ksh . .test echo $TEST_FLAG When i execute the test1.ksh its showing the value as 1. But if i refer the same variable in another script, the value is not 1. Basically, I need to have... (1 Reply)
Discussion started by: risshanth
1 Replies

2. Shell Programming and Scripting

Manipulating a variable across multiple shell scripts

I have a shell script similar to: #!/bin/sh a=1 source a1.sh -- Modifies a source a2.sh -- Modifies a echo "After execution, value of a is $a" What i need is a1.sh script modify the same variable a and same with a2.sh. Now the echo "After execution, value of a is $a" should print the... (1 Reply)
Discussion started by: indianjassi
1 Replies

3. Shell Programming and Scripting

Multiple variable in a variable in Perl

Hi All, I am trying to convert the below Csh while loop into Perl while loop but the problem is that in this csh script, i have 2 variables inside a variable -> $count is a variable {SB$count} as a whole is another variable. Csh is able to assign values to such variable like the below but i do... (3 Replies)
Discussion started by: Raynon
3 Replies

4. Shell Programming and Scripting

Define multiple mail recipents in a variable in perl

hi I have a perl script from which I call a shell script and pass mail variable to it. The mail works fine if I give 1 recipient but fails for multiple. conv.pl:- $mialing = "anu\@abc.com" rest.sh $mialing rest.sh mail -s "hi" $1 This works fine But I need to define multiple... (2 Replies)
Discussion started by: infyanurag
2 Replies

5. Shell Programming and Scripting

Updating a CSV file by multiple PERL scripts

Hi Friends, I'm writing code to update a CSV file by multiple PERL scripts. I've around 2000 PERL scripts which need to register their entries into a CSV file. Hence, I'm inserting following line code in all the 2000 PERL scripts. open(FILE,... (5 Replies)
Discussion started by: Lokesha
5 Replies

6. Shell Programming and Scripting

Passing a variable to #BSUB -n in a LSF file

Hi There! I'm writing this LSF script to make it easier to send jobs to a cluster when varying certain parameters. At one point I'd like to do something like: set NPROC = 10 and later on call BSUB using something like: #BSUB -n $NPROC unfortunately for me, this throws an error: ... (4 Replies)
Discussion started by: lrayo
4 Replies

7. Programming

help need in the perl script that create one xml file form multiple files.

Hi every one, Please excuse me if any grammatical mistakes is there. I have multiple xml files in one directory, I need to create multiple XML files into one XML file.example files like this</p> file1:bvr.xml ... (0 Replies)
Discussion started by: veerubiji
0 Replies

8. Shell Programming and Scripting

Change Variable Value from Multiple Scripts and Use these Variable

Hi to All, Please find below details. file_config.config export file1_status="SUCCESS" export file2_status="SUCCESS" file_one.sh I am calling another two shell script from these script. I need to pass individual two script status (If it's "FAILED") to file_main.sh. file_main.sh I... (2 Replies)
Discussion started by: div_Neev
2 Replies

9. Shell Programming and Scripting

Perl match multiple numbers from a variable similar to egrep

I want to match the number exactly from the variable which has multiple numbers seperated by pipe symbol similar to search in egrep.below is the code which i tried #!/usr/bin/perl my $searchnum = $ARGV; my $num = "148|1|0|256"; print $num; if ($searchnum =~ /$num/) { print "found"; }... (2 Replies)
Discussion started by: kar_333
2 Replies

10. Shell Programming and Scripting

Perl multiple qr assigned to variable

Experts, I'm having problems with the code below. I'm trying to test $var2 for two different regexs. I thought it could be done per below, but I'm getting the following error when running. $ ./test.pl b fed50c0100**** Unescaped left brace in regex is deprecated, passed through in regex; marked... (2 Replies)
Discussion started by: timj123
2 Replies
File::Slurp::WithinPolicy(3pm)				User Contributed Perl Documentation			    File::Slurp::WithinPolicy(3pm)

NAME
File::Slurp::WithinPolicy - Applies filesystem policies to File::Slurp SYNOPSIS
use File::Slurp::WithinPolicy qw(:all); my $text = read_file( 'filename' ); my @lines = read_file( 'filename' ); write_file( 'filename', $text ); append_file( 'filename', $more_text ); overwrite_file( 'filename', $text ); my @files = read_dir( '/path/to/dir' ); DESCRIPTION
This provides the File::Slurp interface within a policy defined by File::Policy. By default, File::Policy is a no-op and this behaves identically to File::Slurp. System administrators may want to override the default File::Policy implementation to enforce a local filesys- tem policy (see File::Policy). FUNCTIONS
read_dir See "read_dir" in File::Slurp read_file See "read_file" in File::Slurp write_file See "write_file" in File::Slurp append_file See "append_file" in File::Slurp overwrite_file See "overwrite_file" in File::Slurp EXPORTS
By default, nothing is exported. The ":all" tag can be used to export everything. Individual methods can also be exported. SEE ALSO
File::Slurp, File::Policy VERSION
$Revision: 1.4 $ on $Date: 2005/06/15 10:40:21 $ by $Author: simonf $ AUTHOR
John Alden <cpan _at_ bbc _dot_ co _dot_ uk> COPYRIGHT
(c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL. See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt perl v5.8.8 2005-06-15 File::Slurp::WithinPolicy(3pm)
All times are GMT -4. The time now is 10:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy