Sponsored Content
Top Forums Shell Programming and Scripting Mathematical Operations on Column Post 302955683 by Don Cragun on Sunday 20th of September 2015 05:31:38 PM
Old 09-20-2015
What have you tried?

What operating system and shell are you using?

Last edited by Don Cragun; 09-20-2015 at 06:33 PM.. Reason: Ask about OS and shell.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error in mathematical calculation using bc

I am getting the error: Runtime error (func=(main), adr=10): Divide by zero When executing the mathematical expression: echo "scale=2; 1-(0/0)"|bc How to overcome this? (5 Replies)
Discussion started by: proactiveaditya
5 Replies

2. Shell Programming and Scripting

awk command: column operations

I have a txt file with two columns Freq Loss 10 30 20 40 30 10 40 50 50 60i have used the below code to get the minimum value out of this array in second cloumn. awk 'NR==N{min=$N;max=$N}NR>N{if ($N>max){max=$N};if ($N<min){min=$N}}END {print... (3 Replies)
Discussion started by: shashi792
3 Replies

3. UNIX for Dummies Questions & Answers

arithmetic operations on 1 column of a file

Hi, I have a file with thousands of lines like this: Chr1 477515 . ACCCC ACCC 17.7 . INDEL;DP=17;AF1=1;CI95=0.5,1;DP4=0,1,0,3;MQ=32;PV4=1,0.036,1,1 Chr1 481987 . A AAAT 62 . INDEL;DP=11;AF1=1;CI95=0.5,1;DP4=0,0,1,3;MQ=41 I want to make a file with... (2 Replies)
Discussion started by: fadista
2 Replies

4. Shell Programming and Scripting

Can BASH handle mathematical operations and do a Search & Replace?

Hello, I have a bunch of xml file that needs to have edits made and I was wondering if a BASH script could handle it. I would like the script to look within my xml files and replace all integers greater than 5px with a value that is 25% smaller. For example, 100px = 75px. Since the integers... (12 Replies)
Discussion started by: jl487
12 Replies

5. Shell Programming and Scripting

Mathematical Loop

Hi, I'm creating a loop that allows the user to enter any number, then their choice of operator and then another number until their operator choice is equal to = But I am getting an error saying integer expression expected. Any explanation on why this is happening? echo "Please enter a number"... (1 Reply)
Discussion started by: Addman1991
1 Replies

6. Shell Programming and Scripting

Mathematical calculations in shellscript

Hi want to do below mathematical calculations in shellscrip but it is not giving me the exact output.Please help me to solve this price=95.3 price1=(20/100)*$price+$price echo "price=$price1" finally the output should display price=114.36 Thanks (5 Replies)
Discussion started by: aish11
5 Replies

7. UNIX for Dummies Questions & Answers

Adding a column to a text file based on mathematical manipulation

Hi, I have a tab delimited text file with three different columns. I want to add an extra column to the text file. The extra column will be the second column and it will equal third column - 1. How do I go about doing that? Thanks! Input: chr1 788822 rs11240777 chr1 1008567 rs9442372... (2 Replies)
Discussion started by: evelibertine
2 Replies

8. Homework & Coursework Questions

Mathematical scripting question

Hello Guys,For my homework I must write a shell script to do this serie, http://upload.wikimedia.org/math/f/8/f/f8f543d9ecd01c4ecca2a0b7bc1234a2.pngI know that I must use the "bc" for that, but for the script's itself i have no idea,(beginner) Can you plz just help me for have some idea?... (1 Reply)
Discussion started by: hamed.samie
1 Replies

9. Homework & Coursework Questions

Help mathematical shell programming

Hello Guys,For my homework I must write a shell script to do this serie, http://upload.wikimedia.org/math/f/8/f/f8f543d9ecd01c4ecca2a0b7bc1234a2.pngI know that I must use the "bc" for that, but for the script's itself i have no idea,(beginner) Can you plz just help me for have some idea?... (1 Reply)
Discussion started by: hamed.samie
1 Replies

10. Shell Programming and Scripting

Mathematical calculations using shell

Dear All, I read some variables in a file and assigned as name for each of them. If I do echo I am able to see the values as 1.0E-05,3.4,5.0E-03 etc, Now I want to do some mathematical operations with them. Lets say 1 1.0E-05*5.0E-03 expected ans is 5.0E-08 2 1.0E-05/5.0E-03 expected... (9 Replies)
Discussion started by: linuxUser_
9 Replies
CUBRID_COLUMN_NAMES(3)							 1						    CUBRID_COLUMN_NAMES(3)

cubrid_column_names - Get the column names in result

SYNOPSIS
array cubrid_column_names (resource $req_identifier) DESCRIPTION
The cubrid_column_names(3) function is used to get the column names of the query result by using $req_identifier. PARAMETERS
o $req_identifier -Request identifier. RETURN VALUES
Array of string values containing the column names, when process is successful. FALSE, when process is unsuccessful. EXAMPLES
Example #1 cubrid_column_names(3) example <?php $conn = cubrid_connect("localhost", 33000, "demodb", "dba"); $result = cubrid_execute($conn, "SELECT * FROM game WHERE host_year=2004 AND nation_code='AUS' AND medal='G'"); $column_names = cubrid_column_names($result); $column_types = cubrid_column_types($result); printf("%-30s %-30s %-15s ", "Column Names", "Column Types", "Column Maxlen"); for($i = 0, $size = count($column_names); $i < $size; $i++) { $column_len = cubrid_field_len($result, $i); printf("%-30s %-30s %-15s ", $column_names[$i], $column_types[$i], $column_len); } cubrid_disconnect($conn); ?> The above example will output: Column Names Column Types Column Maxlen host_year integer 11 event_code integer 11 athlete_code integer 11 stadium_code integer 11 nation_code char 3 medal char 1 game_date date 10 SEE ALSO
cubrid_prepare(3), cubrid_execute(3), cubrid_column_types(3). PHP Documentation Group CUBRID_COLUMN_NAMES(3)
All times are GMT -4. The time now is 05:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy