i know how to add two numbers using expr,
but if i have a file with hundreds of numbers, how do i add them all together, without typing them all one by one?
for example, file.txt contains
4
5
6
7
how can i give a command to add them, without typing
$ expr `4 + 5 + 6 + 7` (7 Replies)
Hi this is quite a simple question... I am new to LINUX/UNIX and so I am just trying to create a very basic program. The idea is that when the user runs the program (from the shell) they enter 3 values and the program will add them up:
"./sum 23 5 1
29"
my code for this program is as follows:
... (4 Replies)
Hi
I figured how to add my list of numbers. However how do I count so that after a certain number it lists the line.
Example:
12 test1
46 test2
195 test3
174 test4
634 test5
185 test6
94 test7
So basically add the numbers and when the addition reaches 300 or less
print the... (8 Replies)
I am writing a bash script on ubuntu11.10
I have some string having numbers and letter and want to add all the numbers together
For example
1s2d23f
I want to perform
1 + 2 + 23 and store it in a variable (3 Replies)
I have a file which has following contents which I want to add up.
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
139038.72
139038.72
139038.72
139038.72 (5 Replies)
Hello. Trying to add a column of numbers and combine the 1st and 2nd fields as uniq with the new total.
This works to add the numbers but can't figure an easy was to combine the 1st and 2nd column as the list is very long. awk '{s+=$3} END {print s}'
bird dog 300
bird dog 100
cat clown 200... (1 Reply)
Hi All,
I have a file with long list of numbers. This file contains only one column. These numbers are very large. I am using following command:
cat myfile.txt | awk '{ sum+=$1} END {print sum}'
The output is coming in scientific notation. How do I get the result in proper format?
... (4 Replies)
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
Hi All,
Could you please help me on this requirement.
File data:
A
A
A
B
B
B
i need the output like
A1
A2
A3
B1 (3 Replies)
Discussion started by: bmk123
3 Replies
LEARN ABOUT MOJAVE
net::dns::rr::loc5.18
Net::DNS::RR::LOC(3) User Contributed Perl Documentation Net::DNS::RR::LOC(3)NAME
Net::DNS::RR::LOC - DNS LOC resource record
SYNOPSIS
use Net::DNS;
$rr = new Net::DNS::RR('name LOC latitude longitude altitude size hp vp');
DESCRIPTION
DNS geographical location (LOC) resource records.
METHODS
The available methods are those inherited from the base class augmented by the type-specific methods defined in this package.
Use of undocumented package features or direct access to internal data structures is discouraged and could result in program termination or
other unpredictable behaviour.
latitude
$latitude = $rr->latitude;
($deg, $min, $sec, $ns ) = $rr->latitude;
$rr->latitude( 42.357990 );
$rr->latitude( 42, 21, 28.764, 'N' );
$rr->latitude( '42 21 28.764 N' );
When invoked in scalar context, latitude is returned in degrees, a negative ordinate being south of the equator.
When invoked in list context, latitude is returned as a list of separate degree, minute, and second values followed by N or S as
appropriate.
Optional replacement values may be represented as single value, list or formatted string. Trailing zero values are optional.
longitude
$longitude = $rr->longitude;
($deg, $min, $sec, $ew ) = $rr->longitude;
$rr->latitude( 71.014338 );
$rr->latitude( 71, 0, 51.617, 'W' );
$rr->latitude( '71 0 51.617 W' );
When invoked in scalar context, longitude is returned in degrees, a negative ordinate being west of the prime meridian.
When invoked in list context, longitude is returned as a list of separate degree, minute, and second values followed by E or W as
appropriate.
altitude
$altitude = $rr->altitude;
Represents altitude, in metres, relative to the WGS 84 reference spheroid used by GPS.
size
$size = $rr->size;
Represents the diameter, in metres, of a sphere enclosing the described entity.
hp
$hp = $rr->hp;
Represents the horizontal precision of the data expressed as the diameter, in metres, of the circle of error.
vp
$vp = $rr->vp;
Represents the vertical precision of the data expressed as the total spread, in metres, of the distribution of possible values.
latlon
($lat, $lon) = $rr->latlon;
Returns the latitude and longitude coordinate pair as signed floating-point degrees.
version
$version = $rr->version;
Version of LOC protocol.
COPYRIGHT
Copyright (c)1997 Michael Fuhr.
Portions Copyright (c)2011 Dick Franks.
Package template (c)2009,2012 O.M.Kolkman and R.W.Franks.
All rights reserved.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl, Net::DNS, Net::DNS::RR, RFC1876
perl v5.18.2 2014-01-16 Net::DNS::RR::LOC(3)