Sponsored Content
Top Forums Shell Programming and Scripting Subtracting values from variable Post 302714495 by pamu on Friday 12th of October 2012 08:52:42 AM
Old 10-12-2012
try using nawk
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storing values in variable

Hi All, Here is the description of the problem. I am scripting for database access using k-shell on solaris box dbaccess <databasename> - << EOF 2>/dev/null | awk 'BEGIN {FS=" "}\ {printf "%s", $1}' | grep -v "^$" | \ read cnt1 OUTPUT TO PIPE cat WITHOUT HEADINGS select count(*) from... (1 Reply)
Discussion started by: matrixmadhan
1 Replies

2. UNIX for Dummies Questions & Answers

Subtracting an Integer from a Variable

Hello, I am in following situation.- COUNT=`ls -l | wc -l` echo $COUNT ---> 26 NO_OF_FILES=$COUNT-1 echo $NO_OF_FILES ---> 26-1 Here, I want the output to be 25. How could I do this. It seems simple, but I am not getting it. Please help me. (2 Replies)
Discussion started by: The Observer
2 Replies

3. UNIX for Dummies Questions & Answers

Dynamic variable values

Bit of a newbie :D with regard to unix scripting and need some advice. Hopefully someone can help with the following: I have a predefined set of variables as follows: AAA_IP_ADD=1.1.1.1 BBB_IP_ADD=2.2.2.2 I have a funnction call which retrieves a value into $SUPPLIER which would be... (3 Replies)
Discussion started by: ronnie_uk
3 Replies

4. Shell Programming and Scripting

Reading variable from file variable values

Hi, Here is the output of lpstat. I would like to read value of Queue which is(abxxxxb1)and status that is DOWN in first line. i dont care what is in second line. any one can help me.thanks Queue Dev Status Job Files User PP % Blks Cp Rnk ------- ----- ---------... (5 Replies)
Discussion started by: sagii
5 Replies

5. Shell Programming and Scripting

Assign values to variable

Hi Masters, I want to assign the values of one variable to another variable. Here the varaible name 'var' is dynamic. I know the values of V_2 and U_3, but If the i/p of TYPE is 'U' and the NO is 3, then I want to assign the values of U_3 to var. How we can achieve it? TYPE="U"... (4 Replies)
Discussion started by: ecearund
4 Replies

6. UNIX for Dummies Questions & Answers

Subtracting values from 2 columns in a file

Hello, I have a file with 5 columns that looks like this: A1BG chr19 + 58863335 58866549 A1BG chr19 - 58858171 58864865 A2LD1 chr13 - 101182417 101186056 A2LD1 chr13 - 101182417 101241046 A2M chr12 - 9220303 9268558 A2ML1 ... (5 Replies)
Discussion started by: wolf_blue
5 Replies

7. Shell Programming and Scripting

Searching columns and subtracting values in awk

Hi everyone, I had a similar question a couple days ago but my problem has gotten significantly (to me anyway) more complex. I have two files: File 1: 0808 166 166 62 9 0 1000fights 1 1 2 1 0 100places2visit 2 2 2 2 0 10veronica91 167 167 3 1 0 11thgorgeous 346 346 3806 1461 122... (2 Replies)
Discussion started by: collards
2 Replies

8. Shell Programming and Scripting

Filtering values in variable

Hi, is there a faster/simpler way to filter values from the variable1 in variable2? example: variable1="A|B|C|E" variable2="A|B|C|D|F" output: "A|B|C" Thanks, zzavilz (4 Replies)
Discussion started by: zzavilz
4 Replies

9. Shell Programming and Scripting

Variable with multiple values

Hello I need to alter a script to check for a flag file but there are now more than one type of flag file in my directory. Basically if any of these flg files exist then the MASK value should be set? Flag files to be included in assignment to variable e2e_scheduled*.flg COLL_STOP*.flg... (1 Reply)
Discussion started by: andymay
1 Replies

10. UNIX for Beginners Questions & Answers

Changing CSV files with date . Subtracting date by values

Hi All, I have a CSV file which is as below. Basically I need to take the year column in it and find if the year is >= 20152 . If that is then I should subtract all values by 6. In the below example in description I am having number mentioned as YYWW so I need to subtract those by -5. Whereever... (8 Replies)
Discussion started by: arunkumar_mca
8 Replies
fixsub(3alleg4) 						  Allegro manual						   fixsub(3alleg4)

NAME
fixsub - Safe function to subtract fixed point numbers clamping underflow. Allegro game programming library. SYNOPSIS
#include <allegro.h> fixed fixsub(fixed x, fixed y); DESCRIPTION
Although fixed point numbers can be subtracted with the normal '-' integer operator, that doesn't provide any protection against overflow. If overflow is a problem, you should use this function instead. It is slower than using integer operators, but if an overflow occurs it will set `errno' and clamp the result, rather than just letting it wrap. Example: fixed result; /* This will put 4965 into `result'. */ result = fixsub(itofix(5000), itofix(35)); /* Sets `errno' and puts -32768 into `result'. */ result = fixsub(itofix(-31000), itofix(3000)); ASSERT(!errno); /* This will fail. */ RETURN VALUE
Returns the clamped result of subtracting `y' from `x', setting `errno' to ERANGE if there was an overflow. SEE ALSO
fixadd(3alleg4), fixmul(3alleg4), fixdiv(3alleg4) Allegro version 4.4.2 fixsub(3alleg4)
All times are GMT -4. The time now is 08:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy