Sponsored Content
Top Forums Shell Programming and Scripting How To Perform Mathematical Operation Within If in awk? Post 302854591 by Chubler_XL on Tuesday 17th of September 2013 04:42:27 PM
Old 09-17-2013
Quote:
Originally Posted by Corona688
The order of operations in that is ambiguous. Parenthesize defensively.

Code:
( ($15-$14)+1==$11 )

Corona688,

+ and - are associative, so I don't know how there could be any ambiguity.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Can you perform mathematical equations in UNIX?

Hello one and all, I have a basic background in UNIX, but I was wondering if there is a way to perform simple mathematical equations (like multiplication, addition)? If so, is there a way to multiply values from a column by a value to produce a column with the answers? :confused: I am... (4 Replies)
Discussion started by: VioletFairy
4 Replies

2. Shell Programming and Scripting

How to perform arithmetic operation on date

Hi all, I would appreciate if anyone knows how to perform adding to date. As for normal date, i can easily plus with any number. But when it comes to month end say for example 28 Jun, i need to perform a plus with number 3, it will not return 1 Jul. Thanks in advance for your help. (4 Replies)
Discussion started by: agathaeleanor
4 Replies

3. Shell Programming and Scripting

perform some operation on a specific coulmn starting from a specific line

I have a txt file having rows and coulmns, i want to perform some operation on a specific coulmn starting from a specific line. eg: 50.000000 1 1 1 1000.00000 1000.00000 50000.000 19 19 3.69797533E-07 871.66394 ... (3 Replies)
Discussion started by: shashi792
3 Replies

4. Shell Programming and Scripting

Enter third column & Perform Operation

I am trying to enter a third column in this file, but the third column should that I call "Math" perform a some math calculations based on the value found in column #2. Here is the input file: Here is the desired output: Output GERk0203078$ Levir Math Cotete_1... (5 Replies)
Discussion started by: Ernst
5 Replies

5. Shell Programming and Scripting

[Solved] Mathematical operation in multiple files

Hi experts, I need to do a mathematical calculation between each data in 3 different files. Output is using formula (A11+B11)/(1+C11). INPUT : File A.txt A11 A12 A21 A22 File B.txt B11 B12 B21 B22 File C.txt C11 C12 C21 C22 OUTPUT: (A11+B11)/(1+C11) (A12+B12)/(1+C12)... (3 Replies)
Discussion started by: guns
3 Replies

6. Shell Programming and Scripting

[Solved] Perform an operation to all directories

Sorry, about this thread - I solved my own problem! Thanks for taking a look. edit by bakunin: no problem, but it would have been a nice touch to actually tell us what the solution was. This would have been slightlich more educating than just knowing that you found it. I changed your title to... (0 Replies)
Discussion started by: Blue Solo
0 Replies

7. Shell Programming and Scripting

Help me to perform count & group by operation in shell scripting?

Hi All, I want to display the distinct values in the file and for each distinct value how may occurance or there. Test data: test1.dat 20121105 20121105 20121105 20121105 20121106 20121106 20121106 20121105 I need to display the output like Output (2 Replies)
Discussion started by: bbc17484
2 Replies

8. Homework & Coursework Questions

Using dbms_pipe with C++ to perform daabase operation

I am getting two result: string and int in c++ code. That I want to store into database. The request which generates result is very frequent. So each time performing db operation to store the result is costly for me. So how this can be achived using dbms_sql? I dont have any experience and how... (1 Reply)
Discussion started by: karimkhan
1 Replies

9. Shell Programming and Scripting

awk script to find data in three file and perform replace operation

Have three files. Any other approach with regards to file concatenation or splitting, etc is appreciated If column55(billngtype) of file1 contains YMNC or YPBC then pick the value of column13(documentnumber). Now find this documentnumber in column1(Billdoc) of file2 and grep the corresponding... (4 Replies)
Discussion started by: as7951
4 Replies

10. UNIX for Beginners Questions & Answers

Copy last few lines of a file, perform math operation and iterate further

Hi, I am trying to generate a data of following order: 4 0 1 642 643 4 642 643 1283 1284 4 1283 1284 1924 1925 4 1924 1925 2565 2566 4 2565 2566 3206 3207 4 3206 3207 3847 3848 4 3847 3848 4488 4489 4 4488 4489 5129 5130 ---------------------- 4 1 2 643 644 4 643 644 1284... (6 Replies)
Discussion started by: SaPa
6 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy