When I run isql with a script file:
isql.exe -q -e -i %1 -o %~n1.log
Then in the output file I see commands, but the error of commands I see on the screen when it run.
The Error doesn't isn't written to the output file. Which command should I use so the errors are also written to the output file?
You have to use the -m(erge) command line switch in order to send the error messages into the output file.
Related
I have tried to submit the script below to HPC
#!/bin/bash
#PBS -N bwa_mem_tumor
#PBS -q batch
#PBS -l walltime=02:00:00
#PBS -l nodes=2:ppn=2
#PBS -j oe
sample=x
ref=absolute/path/GRCh38.p13.genome.fa
fwd=absolutepath/forward_read.fq.gz
rev=absolutepath/reverse_read.fq.gz
module load bio/samtools/1.9
bwa mem $ref $fwd $rev > $sample.tumor.sam && samtools view -S $sample.tumor.sam -b > $sample.tumor.bam && samtools sort $sample.tumor.bam > $sample.tumor.sorted.bam
However as an output I can get only the $sample.tumor.sam and log file says that
Lmod has detected the following error: The following module(s) are unknown:
"bio/samtools/1.9"
Please check the spelling or version number. Also try "module spider ..."
It is also possible your cache file is out-of-date; it may help to try:
$ module --ignore-cache load "bio/samtools/1.9"
Also make sure that all modulefiles written in TCL start with the string
#%Module
However when I input modeles avail it shows that bio/samtools/1.9 is on the list.
Also when i use the option module --ignore-cache load "bio/samtools/1.9"
the result is the same
If i try to continue working with the sam file and input manually the command line
samtools view -b RS0107.tumor.sam > RS0107.tumor.bam
it shows
[W::sam_read1] Parse error at line 200943
[main_samview] truncated file.
What's possibly wrong with the samtools module ir we with the script?
I would like to be able to
Display STDERR on the screen
Copy STDOUT and STDERR in files (and if possible in the same file)
For information, I am using Msys to do that.
.
After doing some research on the SO, I have tried to use something like
<my command> > >(tee stdout.log) 2> >(tee stderr.log)
Bu I got the following error:
sh: syntax error near unexpected token `>'
.
Any idea on how to do that?
There might be no direct solution in Msys but the >(tee ... ) solution works fine in *Nix, OSX, and probably Cygwin.
The workaround is to grep all the errors and warnings we want to keep them on the screen.
I have successfully used the following command for a makefile to compile C code:
make 2>&1 | tee make.log | grep -E "(([Ee]rror|warning|make):|In function|undefined)"
I have a simple script (test.sh) that generates STDOUT and STDERR:
#!/bin/bash
echo hello
rm something
exit
Then, to do what you want execute with the following:
./test.sh > stdout.log 2> >(tee stderr.log >&2)
You'll get the STDERR on the screen, and two separated log files with STDERR and STDOUT. I used part of the answer given here
Note that I am assuming you don't have a file called something on the current directory :)
If you want both STDOUT and STDERR to go to the same file, use the -a option on tee:
./test.sh > std.log 2> >(tee -a std.log >&2)
In Perforce CLI, the output of this command: p4 login -s is Perforce password (P4PASSWD) invalid or unset. if no user is logged in (see screenshot below).
When I pipe this command to Find command, I expect to get a blank line, but I still get the same line:
How can I pipe this command as I expect?
The Perforce password (P4PASSWD) invalid or unset. message is output to STDERR, and find (and findstr, for that matter) only operate on STDOUT. To solve this, use this:
p4 login -s 2>&1 | find "gg"
This will tie the output of STDERR (that is, stream 2) to STDOUT (stream 1).
Is it possible to export weka results after execute it via command line?
What I am doing:
java -cp "./weka.jar" weka.classifiers.bayes.NaiveBayes -t "iris.arff" -i
But then, I have all the statistics in console, is there any way to export this? Or I have to read and write by myself?
Thanks!
An example from the Weka Primer:
java -Xmx1024m weka.classifiers.trees.J48 -t data.arff -i -k -d J48-data.model >&! J48-data.out &
So no, WEKA doesn't have a specific output parameter on the command line, but you simply redirect the output and errors to a file using >&! or only the output without errors using >.
In your case you could use this command to save the output to the file NaiveBayes-iris.out:
java -cp "./weka.jar" weka.classifiers.bayes.NaiveBayes -t "iris.arff" -i > NaiveBayes-iris.out
I am trying to see what exact command line arguments are being sent to scanimage from xsane. I tried ltrace but couldn't find "scanimage" anywhere in the log. In general, suppose you know some GUI program is a frontend of a command line pro
If xsane call scanimage, you will find that by replacing the scanimage executable by this script temporarily :
#!/bin/bash
exec &>/tmp/trace
echo "$0" "$#"
Then,
chmod +x /usr/bin/scanimage
xsane
cat /tmp/trace