Perl command in bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl command in bash
# 29  
Old 03-31-2015
The set -x is below: things appear to ok?

I will investigate how the script is called. Thank you Smilie.

Code:
NOTICE: Multianno output file is written to del.txt.hg19_multianno.txt
+ printf 'The annotation is complete, would you like analyze additional target g
ene patients? Y/N '
The annotation is complete, would you like analyze additional target gene patien
ts? Y/N + read match_choice
n
+ case "$match_choice" in
+ id=del
+ remove
+ printf '\n\n'


+ printf 'Removing old files, please wait '
Removing old files, please wait + rm 'C:\Users\cmccabe\Desktop\annovar\out_posit
ion.txt'
+ rm 'C:\Users\cmccabe\Desktop\annovar\out_parse.txt'
+ cd C:
+ rm c:/Users/cmccabe/Desktop/Python27/del.txt
+ cd C:
+ rm c:/Users/cmccabe/Desktop/Python27/out_name.txt
+ printf '\n Old files removed, formatting for matrix '

 Old files removed, formatting for matrix + matrix
+ cd 'C:\Users\cmccabe\Desktop\annovar'
+ perl matrix.pl
Can't open : No such file or directory at matrix.pl line 44.
+ printf 'Process complete and new file saved in L:NGS3_BUSINESSMatrixTorrentmat
rix_del.txt, Are there additional target gene patients? Y/N '
Process complete and new file saved in L:NGS3_BUSINESSMatrixTorrentmatrix_del.tx
t, Are there additional target gene patients? Y/N + read match_choice

# 30  
Old 03-31-2015
Quote:
Originally Posted by cmccabe
The set -x is below: things appear to ok?...
Do they appear ok to you?

Quote:
Originally Posted by cmccabe
...I will investigate how the script is called. ...
That's a good approach. I can tell you the problem but it will be better if you find it out yourself.
# 31  
Old 03-31-2015
Another set -x Part of the problem was the entire path was needed and that fixed the output, but the input is not being read (in bold). Thank you Smilie.

Code:
 perl 'C:\Users\cmccabe\Desktop\annovar\matrix.pl' < 'C:\Users\cmccabe\Desktop\annovar\"${id}".txt.hg19_multianno.txt' > L:/NGS/3_BUSINESS/Matrix/Torrent/matrix_"${id}".txt


Code:
NOTICE: Multianno output file is written to snp.txt.hg19_multianno.txt
+ printf 'The annotation is complete, would you like analyze additional target g
ene patients? Y/N '
The annotation is complete, would you like analyze additional target gene patien
ts? Y/N + read match_choice
n
+ case "$match_choice" in
+ id=snp
+ remove
+ printf '\n\n'


+ printf 'Removing old files, please wait '
Removing old files, please wait + rm 'C:\Users\cmccabe\Desktop\annovar\out_posit
ion.txt'
+ rm 'C:\Users\cmccabe\Desktop\annovar\out_parse.txt'
+ cd C:
+ rm c:/Users/cmccabe/Desktop/Python27/snp.txt
+ cd C:
+ rm c:/Users/cmccabe/Desktop/Python27/out_name.txt
+ printf '\n Old files removed, formatting for matrix '

 Old files removed, formatting for matrix + matrix
+ perl 'C:\Users\cmccabe\Desktop\annovar\matrix.pl'
c:\cygwin\home\cmccabe\bashparse.sh: line 215: C:\Users\cmccabe\Desktop\annovar\
"${id}".txt.hg19_multianno.txt: No such file or directory
+ printf 'Process complete and new file saved in L:/NGS/3_BUSINESS/Matrix/Torren
t/matrix_snp.txt, Are there additional target gene patients? Y/N '

# 32  
Old 03-31-2015
Not quite sure about the linebreaks, if they were caused by a small terminal window, or by 'string-generation'...
Code:
+ perl 'C:\Users\cmccabe\Desktop\annovar\matrix.pl'
c:\cygwin\home\cmccabe\bashparse.sh: line 215: C:\Users\cmccabe\Desktop\annovar\
"${id}".txt.hg19_multianno.txt: No such file or directory

It states that it is looking for a literal "${id}".
Seems there is too much escaped or wrongly quoted.

Is the filename supposed to have <str>.txt.<str>.txt?

hth
# 33  
Old 03-31-2015
Is the filename supposed to have <str>.txt.<str>.txt?
Yes this is correct.
# 34  
Old 03-31-2015
Quote:
Originally Posted by cmccabe
...but the input is not being read (in bold). ...
...
You'll need to do more investigation for that one.
Pay very close attention to the little details in all my previous posts in this thread and you should be able to find the problem.
# 35  
Old 04-01-2015
I am reading all of your threads and not having any luck, I am still investigating but it appears to be the way that the input file is being read by the perl script. Is that right? Thank you Smilie.


Code:
 perl matrix.pl < "${id}".txt.hg19_multianno.txt > L:/NGS/3_BUSINESS/Matrix/Torrent/matrix_"${id}".txt


It was the way it was called... I see now that the < input and > output are not needed:

Code:
 perl matrix.pl "${id}".txt.hg19_multianno.txt L:/NGS/3_BUSINESS/Matrix/Torrent/matrix_"${id}".txt

However, the new file that is created only has the headers in it and doesn't carry over the data in the multianno.txt.
Maybe
Code:
 chomp;
          if ($.input) {

Thank you Smilie

Last edited by cmccabe; 04-01-2015 at 12:56 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run several bash commands put in bash command line?

How to run several bash commands put in bash command line without needing and requiring a script file. Because I'm actually a windows guy and new here so for illustration is sort of : $ bash "echo ${PATH} & echo have a nice day!" will do output, for example:... (4 Replies)
Discussion started by: abdulbadii
4 Replies

2. Shell Programming and Scripting

How to call a bash command from within a perl script?

In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command. perl -e 'myperlcommand(arguments)' perl -e 'print("UUUU"x4)' Now, how can one call a bash command from within a perl script? (Suppose that mybashcommand is a bash... (1 Reply)
Discussion started by: LessNux
1 Replies

3. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

4. AIX

Typing "bash" at the command line spawns two bash processes

Server: IBM p770 OS: AIX 6.1 TL5 SP1 When one of our develoeprs types "bash" on the command line to switch shells, it hangs. For some reason, two bash processes are created....the first bash process spawns a second bash process in the same console, causing a hang. Anyone have any idea what... (2 Replies)
Discussion started by: wjssj
2 Replies

5. Shell Programming and Scripting

perl/unix: script in command line works but not in perl

so in unix this command works works and shows me a list of directories find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt but when i try running a perl script to run this command my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Discussion started by: kpddong
2 Replies

6. Shell Programming and Scripting

Calling bash command in perl script

Hi, I have tried several times but failed, I need to call this script from the perl script. This one line script will be sent to /var/tmp/error Bash command: /usr/openv/netbackup/bin/admincmd/bperror -backstat -l -hoursago 12 |awk '{ print $19, $12, $14, $16}'|grep -vi default|sort >... (12 Replies)
Discussion started by: sQew
12 Replies

7. Shell Programming and Scripting

combine two perl lines into a single perl command

Hi Everyone, i have a string 00:44:40 so: $tmp=~ s/://gi; $tmp=~s/({2})({2})({2})/$1*3600+$2*60+$3/e; the output is 2680. Any way to combine this two lines into a single line? Thanks (4 Replies)
Discussion started by: jimmy_y
4 Replies

8. Shell Programming and Scripting

Mixing Perl with Bash

I am fiddling with a little script that will issue a shutdown command if the temperature on the CPU goes above a certain level. I started writing the script in Bash, and then thought I would like to use Perl to extract the detailed bits, but I am not sure if this is really practical. Basically I... (2 Replies)
Discussion started by: kermit
2 Replies

9. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

10. Shell Programming and Scripting

passing variable from bash to perl from bash script

Hi All, I need to pass a variable to perl script from bash script, where in perl i am using if condition. Here is the cmd what i am using in perl FROM_DATE="06/05/2008" TO_DATE="07/05/2008" "perl -ne ' print if ( $_ >="$FROM_DATE" && $_ <= "$TO_DATE" ) ' filename" filename has... (10 Replies)
Discussion started by: arsidh
10 Replies
Login or Register to Ask a Question