04-08-2020
i appreciate your help.
output still 0,
ive trace the code:
[root@srv ~]# bash -x script.sh
+ LOG=/var/log/scan.log
+ TOTAL=0
+ grep Virus /var/log/scan.log
+ read _ _ NUM
+ TOTAL=4
+ read _ _ NUM
+ TOTAL=9
+ read _ _ NUM
+ TOTAL=9
+ read _ _ NUM
+ echo 0
0
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have the following file, how I will calculate the sum of all the entries in the file.
> cat abc
2
3
4
now the sum should be 2+3+4 = 9 (4 Replies)
Discussion started by: sdosanjh
4 Replies
2. Shell Programming and Scripting
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies
3. Shell Programming and Scripting
Hi,
I have a file and I want to sum all the numbers in it.
Example of the file:
0.6714359
-3842.59553830551
I used your forum (https://www.unix.com/shell-programming-scripting/74293-how-get-sum-all-lines-file.html) and found a script, what worked for me:
awk '{a+=$0}END{print a}'... (8 Replies)
Discussion started by: mario8eren
8 Replies
4. Shell Programming and Scripting
Hi,
So I'm kinda new to shell scripts and the like. I've picked up quite a bit of use from browsing the forums here but ran into a new one that I can't seem to find an answer for.
I'm looking to parse/find a string AND the next 15 or so charachters that follow the string within a text file... (1 Reply)
Discussion started by: kar23me
1 Replies
5. Shell Programming and Scripting
Hi friends,
This is sed & awk type question.
I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example
###start of input text file ####
abc
def
ghi
1
2
3
4
kjld
random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies
6. Shell Programming and Scripting
Hi friends,
This is sed & awk type question. It is slightly different from my previous question.
I have a text file which has numbers spread all over the file. I want to sum the series of numbers (but no more than 10 numbers in series) whenever i find it and produce an output file with the... (4 Replies)
Discussion started by: kaaliakahn
4 Replies
7. UNIX for Dummies Questions & Answers
Dear everyone,
I have a big file with many information in it, but I just want some lines.
I don't know exactly what the number of the line I want, I only know some part of these line. It all starts with the word 'F(tot :1 )'
I use grep command and find it. It looks like that on the screen:... (3 Replies)
Discussion started by: phamnu
3 Replies
8. Shell Programming and Scripting
I have a simple text file having payment amount value on each line. At the end of day 'n' number of payments created difference in amount that I need to match from this file.
I have information about how many payments created difference and difference amount. Please help me to build shell... (3 Replies)
Discussion started by: swats007
3 Replies
9. Shell Programming and Scripting
Hi,
I have a text file like this
6.0000E-02 0.00000E+00 0.0000 0.00000E+00 0.0000
7.0000E-02 5.00000E-10 1.0000 5.00000E-10 1.0000
8.0000E-02 3.00000E-09 0.4082 3.00000E-09 0.4082
9.0000E-02 3.50000E-09 0.3780 3.50000E-09 0.3780
1.0000E-01 1.00000E-09... (2 Replies)
Discussion started by: f_o_555
2 Replies
10. Shell Programming and Scripting
I have a file where every line includes four expressions with a caret in the middle (plus some other "words" or fields, always separated by spaces). I would like to extract from this file, all those lines such that each of the four expressions containing a caret appears in at least four different... (9 Replies)
Discussion started by: uncleMonty
9 Replies
LEARN ABOUT DEBIAN
rg::blast::parser
RG::Blast::Parser(3pm) User Contributed Perl Documentation RG::Blast::Parser(3pm)
NAME
RG::Blast::Parser - fast NCBI BLAST parser
SYNOPSIS
use Data::Dumper;
use RG::Blast::Parser;
my $parser = RG::Blast::Parser->new(); # read from STDIN
open( EXAMPLE, '<', '/usr/share/doc/librg-blast-parser-perl/examples/converged.ali' ) || confess($!);
my $parser = RG::Blast::Parser->new( *EXAMPLE, "converged.ali" ); # read from EXAMPLE, use name "converged.ali" in error messages
while( my $res = $parser->parse() )
{
print Dumper( $res );
}
eval {
my $res = $parser->parse();
# ...
};
if( $@ && $@ =~ /^parser error/ ) { warn("failed to parse blast result - exception caught"); }
DESCRIPTION
This package contains perl binding for a very fast C/C++ library for NCBI BLAST -m 0 (default) output parsing. BLAST results are returned
in a convenient hash structure.
Multiple results may be concatenated for input. One result is parsed and returned at a time.
CONSTRUCTOR
new( [FILEHANDLE, [NAME]] )
Creates an "RG::Blast::Parser". Blast results are read from FILEHANDLE, STDIN by default. The input stream may be named NAME in error
messages (default: "STDIN").
METHODS
parse( [TRACE_PARSING, [TRACE_SCANNING]] )
Parse one complete BLAST result and return it. If no results on input stream, returns "undef". In case of parser error it die()s with
an (at present not very useful) error message.
The following structure is returned in a hash reference:
{
blast_version => STRING,
references => [ STRING, ... ],
rounds => [
{
oneline_idx => NUM, # index of first one-line description of
# round in "onelines"
oneline_cnt => NUM, # number of one-line descriptions of round
# in "onelines"
hit_idx => NUM, # index of first hit of round in "hits"
hit_cnt => NUM, # number of hits of round in "hits"
oneline_new_idx => NUM|undef# index of first new (not-seen-before)
# one-line description of round
oneline_new_cnt => NUM # number of new one-line descriptions of
# round
}, ...
],
q_name => STRING,
q_desc => STRING|undef,
q_length => NUM,
db_name => STRING,
db_nseq => NUM,
db_nletter => NUM,
onelines => [ # one-line descriptions from all rounds
{
name => STRING,
desc => STRING|undef,
bit_score => NUM,
e_value => NUM
}, ...
],
converged => BOOLEAN,
hits => [ # hits from all rounds
{
name => STRING,
desc => STRING|undef,
length => NUM,
hsps => [
{
bit_score => NUM,
raw_score => NUM,
e_value => NUM,
method => STRING,
identities => NUM,
positives => NUM,
gaps => NUM,
q_strand => STRING|undef,
s_strand => STRING|undef,
q_frame => NUM|undef,
s_frame => NUM|undef,
q_start => NUM,
q_ali => STRING,
q_end => NUM,
match_line => STRING,
s_start => NUM,
s_ali => STRING,
s_end => NUM
}, ...
]
}, ...
],
tail => STRING # bulk text after the last hit / one-line
# description
}
If you want tracing for parsing and scanning, you can enable them using the parameters of this call.
result()
Returns the last BLAST result parsed or "undef" if no last result.
get_trace_scanning()
Returns scan trace state as a Boolean value.
set_trace_scanning( BOOLEAN )
Set scan trace - debugging aid.
SEE ALSO
Zerg(3pm), Zerg::Report(3pm)
AUTHOR
Laszlo Kajan, <lkajan@rostlab.org>
COPYRIGHT AND LICENSE
Copyright (C) 2012 by Laszlo Kajan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
perl v5.14.2 2012-03-29 RG::Blast::Parser(3pm)