Hi, i have a file which content the following:
>cat cols
data a:23:data
data b:76:data
data c:-30:data
i would like to sum up the value of column 2, but the result that return to me is 0. Can anyone help?
i'm using this code to do the sum
awk -F" " 'BEGIN {x=0} {x+=$2} END {print... (5 Replies)
Good afternoon! Im new at scripting and Im trying to write a script to
calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Hello :
I need some help in writing a ksh script which will find a particular directory in all the file systems in a server and finally report the total size of the direcotry in all the file systems.
Some thing like this..
find /u*/app/oracle -type d -name "product" -prune
and then... (1 Reply)
HI
I have a file
# cat marks.txt
MARKS LIST
2013
Name english french chinese latin total_marks
wer 34 45 67 23
wqa 12 39 10 56
wsy 23 90 23 78
Now i need to find the total marks of each student using... (11 Replies)
Hi All ,
I have the following script as below , I tried to modify to meet the requirement , could someone help ? very thanks
================================================================================================
while read STR NAME; do
Total=0
MyString="$STR"
GetData () {... (18 Replies)
Trying to use awk to print the lines in file that have either REF or SNV in $3, add a header line, sort by $4 in numerical order. The below code does that already, but where I am stuck is on the last part where the total lines are counted and printed under Total_Targets, under Targets_less_than is... (4 Replies)
Hi
I am having a set of files which will have the card details and the amount that was spending on the card. Each file will have the set of cards and dollar amount spend on it. I am trying to sum the dollar values by card number on each files. Is there a way I do it all in all one steps
File... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
LEARN ABOUT DEBIAN
mojo::base
Mojo::Base(3pm) User Contributed Perl Documentation Mojo::Base(3pm)NAME
Mojo::Base - Minimal base class for Mojo projects
SYNOPSIS
package Cat;
use Mojo::Base -base;
has 'mouse';
has paws => 4;
has [qw(ears eyes)] => 2;
package Tiger;
use Mojo::Base 'Cat';
has stripes => 42;
package main;
use Mojo::Base -strict;
my $mew = Cat->new(mouse => 'Mickey');
say $mew->paws;
say $mew->paws(5)->ears(4)->paws;
my $rawr = Tiger->new(stripes => 23);
say $rawr->ears * $rawr->stripes;
DESCRIPTION
Mojo::Base is a simple base class for Mojo projects.
# Automatically enables "strict", "warnings" and Perl 5.10 features
use Mojo::Base -strict;
use Mojo::Base -base;
use Mojo::Base 'SomeBaseClass';
All three forms save a lot of typing.
# use Mojo::Base -strict;
use strict;
use warnings;
use feature ':5.10';
# use Mojo::Base -base;
use strict;
use warnings;
use feature ':5.10';
use Mojo::Base;
push @ISA, 'Mojo::Base';
sub has { Mojo::Base::attr(__PACKAGE__, @_) }
# use Mojo::Base 'SomeBaseClass';
use strict;
use warnings;
use feature ':5.10';
require SomeBaseClass;
push @ISA, 'SomeBaseClass';
use Mojo::Base;
sub has { Mojo::Base::attr(__PACKAGE__, @_) }
FUNCTIONS
Mojo::Base exports the following functions if imported with the "-base" flag or a base class.
"has"
has 'name';
has [qw(name1 name2 name3)];
has name => 'foo';
has name => sub {...};
has [qw(name1 name2 name3)] => 'foo';
has [qw(name1 name2 name3)] => sub {...};
Create attributes, just like the "attr" method.
METHODS
Mojo::Base implements the following methods.
"new"
my $object = BaseSubClass->new;
my $object = BaseSubClass->new(name => 'value');
my $object = BaseSubClass->new({name => 'value'});
This base class provides a basic object constructor. You can pass it either a hash or a hash reference with attribute values.
"attr"
$object->attr('name');
BaseSubClass->attr('name');
BaseSubClass->attr([qw(name1 name2 name3)]);
BaseSubClass->attr(name => 'foo');
BaseSubClass->attr(name => sub {...});
BaseSubClass->attr([qw(name1 name2 name3)] => 'foo');
BaseSubClass->attr([qw(name1 name2 name3)] => sub {...});
Create attributes. An array reference can be used to create more than one attribute. Pass an optional second argument to set a default
value, it should be a constant or a sub reference. The sub reference will be excuted at accessor read time if there's no set value.
DEBUGGING
You can set the "MOJO_BASE_DEBUG" environment variable to get some advanced diagnostics information printed to "STDERR".
MOJO_BASE_DEBUG=1
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojo::Base(3pm)