Hi Scrutinizer, you are right about array traversal.
------
Regarding the loop , works on my BSD
.... I should work on my scripting portability, thanks for pointing out
can anyone help me how do i add the colums using awk seperated by character @. for eg i have
3@4
2@9
5@1
the result should be
10 14
i tried using
{ sum+= $1 }
END { print sum }
but it just gives the result 10. can anyone help me with this one
thank you and best regards (7 Replies)
Hi All,
happy new year.
I have a file with 4xN columns like
0.0000e+00 0.0000e+00 7.199E+07 7.123E+07 6.976E+07 6.482E+07 5.256E+07 2.523E+07
0.0000e+00 0.0000e+00 8.641E+07 8.550E+07 8.373E+07 7.780E+07 6.309E+07 3.028E+07... (8 Replies)
Hi,
i want to find out the sum of a column in vi/vim not by using any other editor or filter like sed/awk. Is there any function available to do the sum of a column.
let
cat>number.txt
one 1
two 2
five 5
nine 9
here i want the sum of second field is 17, is there any function to... (3 Replies)
Hi All,
I'm new to this forum. So please be patience with me! :)
I have a file that looks like this (all rows have the same number of columns):
19 20 30 15 17 38 51 60 74 85 96 07 ....
10 20 44 59 39 88 13 77 30 10 11 12 ....
.
.
.
I want to sum the value of first field to all the... (2 Replies)
Hi all, I know this sounds suspiciously like a homework course; but, it is not.
My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
My File looks like:
"|" -> Field separator
A|B|C|100|1000
D|E|F|1|2
G|H|I|0|7
D|E|F|1|2
A|B|C|10|10000
G|H|I|0|7
A|B|C|1|100
D|E|F|1|2
I need to do a SUM on Col. 5 and Col.6 by grouping on Col 1,2 & 3
My expected output is:
A|B|C|111|11100 (2 Replies)
Hi Friends,
I have a file with fields separated with comma. How to print sum of each field of the file?
Eg:
input file
1,3,6,7
2,1,2,1
0,1,1,0
I want to sum each field separately.
Output file
3,5,9,8
Thanks,
Suresh (2 Replies)
HI All,
I'm embedding SQL query in Script which gives following output:
Assignee Group Total
ABC Group1 17
PQR Group2 5
PQR Group3 6
XYZ Group1 10
XYZ Group3 5
I have saved the above output in a file.
How do i sum up the contents of this output so as to get following output:
... (4 Replies)
Dear Experts,
I have input file which is comma separated, has 4 columns like below,
BRAND,COUNTRY,MODEL,COUNT
NIKE,USA,DUMMY,5
NIKE,USA,ORIGINAL,10
PUMA,FRANCE,DUMMY,20
PUMA,FRANCE,ORIGINAL,15
ADIDAS,ITALY,DUMMY,50
ADIDAS,ITALY,ORIGINAL,50
SPIKE,CHINA,DUMMY,1O
And expected output add... (2 Replies)
Discussion started by: ricky1991
2 Replies
LEARN ABOUT PHP
php_uname
PHP_UNAME(3) 1 PHP_UNAME(3)php_uname - Returns information about the operating system PHP is running onSYNOPSIS
string php_uname ([string $mode = "a"])
DESCRIPTION php_uname(3) returns a description of the operating system PHP is running on. This is the same string you see at the very top of the
phpinfo(3) output. For the name of just the operating system, consider using the PHP_OS constant, but keep in mind this constant will con-
tain the operating system PHP was built on.
On some older UNIX platforms, it may not be able to determine the current OS information in which case it will revert to displaying the OS
PHP was built on. This will only happen if your uname() library call either doesn't exist or doesn't work.
PARAMETERS
o $mode
-$mode is a single character that defines what information is returned:
o 'a': This is the default. Contains all modes in the sequence "s n r v m".
o 's': Operating system name. eg. FreeBSD.
o 'n': Host name. eg. localhost.example.com.
o 'r': Release name. eg. 5.1.2-RELEASE.
o 'v': Version information. Varies a lot between operating systems.
o 'm': Machine type. eg. i386.
RETURN VALUES
Returns the description, as a string.
EXAMPLES
Example #1
Some php_uname(3) examples
<?php
echo php_uname();
echo PHP_OS;
/* Some possible outputs:
Linux localhost 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686
Linux
FreeBSD localhost 3.2-RELEASE #15: Mon Dec 17 08:46:02 GMT 2001
FreeBSD
Windows NT XN1 5.1 build 2600
WINNT
*/
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
echo 'This is a server using Windows!';
} else {
echo 'This is a server not using Windows!';
}
?>
There are also some related Predefined PHP constants that may come in handy, for example:
Example #2
A few OS related constant examples
<?php
// *nix
echo DIRECTORY_SEPARATOR; // /
echo PHP_SHLIB_SUFFIX; // so
echo PATH_SEPARATOR; // :
// Win*
echo DIRECTORY_SEPARATOR; //
echo PHP_SHLIB_SUFFIX; // dll
echo PATH_SEPARATOR; // ;
?>
SEE ALSO phpversion(3), php_sapi_name(3), phpinfo(3).
PHP Documentation Group PHP_UNAME(3)