Hi Friends
How to do sum on a column?
I have a file like:
FRED 500.01 TX
SMITH 50.10 NY
HARRY 5.00 CA
555.11
Sum on second column.
I am trying using nawk like
nawk 'BEGIN {FS="|"}; {printf $1"+"}'
Thanks a lot for your help
S :) (2 Replies)
I have a text file with two columns
the first column is an integer and the second column is date
how do i sum up the first column according to the date
example
123 jan1
232 jan1
473 jan2
467 jan2
356 jan3
376 jan3
my result should be
355 jan1
940 jan2
732 jan3
how do i... (2 Replies)
Dear all,
I have a rather large file of numbers which i would like to read into a script and then do some maths on a specific column( e.g column).
so far i have been using the following awk command
awk '{print $4}' infile.txt > out.tmp to strip out the desired column within the in perl... (3 Replies)
I have a file which contains data as below:
-----------------------------------------------------------------------------------------------
GSPWeb Statistics for the period of last 20 days... (3 Replies)
Hi,
I am writing a comparator script, which comapre two txt files(column by column)
below are the precondition of this comparator
1)columns of file are not seperated
Ex.
file1.txt
8888812341181892
1243548895685687
8945896789897789
1111111111111111
file2.txt
9578956789567897... (2 Replies)
Dear all,
I have one file like
LABEL A B C D E F G H I J K L M N
G02100 64651.3 25630.7 8225.21 51238 267324 268005 234001 52410.9 18598.2 10611 10754.7 122535 267170 36631.4
G02100 12030.3 8260.15 8569.91 ... (4 Replies)
a,b,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii
a thru ii are digits and strings....
The awk needed....if coloumn 9 == i (coloumn 9 is string ), output the sum of x's(coloumn 22 ) in all records and sum of y's (coloumn 23 ) in all records in a file (records.txt).... (6 Replies)
hi All,
i have a file in which only one column is there.,
test.txt
======
-900.01
-900.02
-900.03
-900.04
-900.05
-900.06
-900.07
-900.08
-900.09
900.01
900.02
900.03
900.04
900.05 (4 Replies)
Hello,
I am facing issue in summing up a column in unix.I am displaying a column sum up to 4 decimal places and below is the code snippet
sed '1d' abc.csv | cut -d',' -f7 | awk '{s+=$1}END{ printf("%.4f\n",s)}'
-170552450514.8603
example of data values in the column(not... (3 Replies)
Discussion started by: karthik adiga
3 Replies
LEARN ABOUT DEBIAN
test::image::gd
Test::Image::GD(3pm) User Contributed Perl Documentation Test::Image::GD(3pm)NAME
Test::Image::GD - A module for testing images using GD
SYNOPSIS
use Test::More plan => 1;
use Test::Image::GD;
cmp_image('test.gif', 'control.gif', '... these images should match');
# or
my $test = GD::Image->new('test.gif');
my $control = GD::Image->new('control.gif');
cmp_image($test, $control, '... these images should match');
# some other test functions ...
size_ok('camel.gif', [ 100, 350 ], '... the image is 100 x 350");
height_ok('test.gif', 200, '... the image has a height of 200');
width_ok('test.gif', 200, '... the image has a width of 200');
DESCRIPTION
This module is meant to be used for testing custom graphics, it attempts to "visually" compare the images, this means it ignores invisible
differences like color palettes and metadata. It also provides some extra functions to check the size of the image.
FUNCTIONS
cmp_image ($got, $expected, $message)
This function will tell you whether the two images will look different, ignoring differences in the order of colors in the color
palette and other invisible changes.
Both $got and $expected can be either instances of "GD::Image" or either a file handle or a file path (both are valid parameters to the
"GD::Image" constructor).
size_ok ($got, [ $width, $height ], ?$message)
This function will check if an image is a certain size.
As with the "cmp_image" function, the $got parameter can be either an instance of "GD::Image" or a file handle or a file path (all are
valid parameters to the "GD::Image" constructor).
height_ok ($got, $height, ?$message)
This function will check if an image is a certain height.
As with the "cmp_image" function, the $got parameter can be either an instance of "GD::Image" or a file handle or a file path (all are
valid parameters to the "GD::Image" constructor).
width_ok ($got, $width, ?$message)
This function will check if an image is a certain width.
As with the "cmp_image" function, the $got parameter can be either an instance of "GD::Image" or a file handle or a file path (all are
valid parameters to the "GD::Image" constructor).
TO DO
Add more functions
This module currently serves a very basic need of mine, however, I am sure as I start writing more tests against images I will find a
need for other testing functions. Any suggestions are welcome.
BUGS
None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.
CODE COVERAGE
I use Devel::Cover to test the code coverage of my tests, below is the Devel::Cover report on this module test suite.
---------------------------- ------ ------ ------ ------ ------ ------ ------
File stmt bran cond sub pod time total
---------------------------- ------ ------ ------ ------ ------ ------ ------
Test/Image/GD.pm 100.0 91.7 63.6 100.0 100.0 100.0 93.7
---------------------------- ------ ------ ------ ------ ------ ------ ------
Total 100.0 91.7 63.6 100.0 100.0 100.0 93.7
---------------------------- ------ ------ ------ ------ ------ ------ ------
SEE ALSO
The "compare" function of "GD::Image" class, that is how this "cmp_image" is implemented.
AUTHOR
Stevan Little, <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2005 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2005-12-09 Test::Image::GD(3pm)