Sponsored Content
Top Forums Shell Programming and Scripting Compare two variables and print the difference Post 303037553 by rdrtx1 on Monday 5th of August 2019 03:01:15 PM
Old 08-05-2019
try:
Code:
#!/bin/sh

PRIM_SEQ=(`some sql code`)
STB_SEQ=(`some sql code`)

c=0
for i in ${PRIM_SEQ[*]}
do
   (( x = PRIM_SEQ[c] - STB_SEQ[c] ))
   echo $x
   (( c = c + 1 ))
done

These 2 Users Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare 2 file and print difference in the third file URG PLS

Hi I have two files in unix. I need to compare two files and print the differed lines in other file Eg file1 1111 2222 3333 file2 1111 2222 3333 4444 5555 newfile 4444 5555 Thanks In advance (3 Replies)
Discussion started by: evvander
3 Replies

2. Shell Programming and Scripting

to compare two files and to print the difference

suppose one file P1168S P2150L P85L Q597R R1097C Another file P2150L P85L Q597R R1097C R1379C R1587K Then output shud be R1379C R1587K thanks (5 Replies)
Discussion started by: cdfd123
5 Replies

3. Shell Programming and Scripting

Compare difference

Hi every body Help required file 1 aaaaa bbbb cccccc dddd ffff File 2 aaaaa,1,ee,44,5t,6y, cccccc, ..... dddd, ..... eeeeee, ..... ffff, ...... ggg, ....... (7 Replies)
Discussion started by: The_Archer
7 Replies

4. Shell Programming and Scripting

Compare two files and print the two lines with difference

I have two files like this: #FILE 1 ABCD 4322 26485 JMTJ 5311 97248 XMPJ 4321 58978 #FILE 2 ABCD 4321 26485 JMTJ 5311 97248 XMPJ 4321 68978 What to do: Compare the two files and find those lines that doesn't match. And have a new file like this: #FILE 3 "from file 1" ABCD 4322 26485... (11 Replies)
Discussion started by: kingpeejay
11 Replies

5. Shell Programming and Scripting

Compare selected columns from a file and print difference

I have learned file comparison from my previous post here. Then, it is comparing the whole line. Now, i have a new problem. I have two files with 3 columns separated with a "|". What i want to do is to compare the second and third column of file 1, and the second and third column of file 2. And... (4 Replies)
Discussion started by: kingpeejay
4 Replies

6. Shell Programming and Scripting

Compare two columns in two files and print the difference

one file . . importing table employee 119 . . importing table jobs 1 2nd file . . importing table employee 120 . . importing table jobs 1 and would like... (2 Replies)
Discussion started by: jhonnyrip
2 Replies

7. UNIX for Dummies Questions & Answers

compare / difference between sub-sections of files

Hi there, I'm sure this question has been asked many times but I can't find any posts with information. How can I check the differences between say lines 20 - 200 in file1 and lines 420 - 600 in file2? Thanks in advance for any help! js (2 Replies)
Discussion started by: js8765
2 Replies

8. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

9. Shell Programming and Scripting

Simple awk command to compare two files and print first difference

Hello, I have two text files, each with a single column, file 1: 124152970 123899868 123476854 54258288 123117283 file 2: 124152970 123899868 54258288 123117283 122108330 (5 Replies)
Discussion started by: LMHmedchem
5 Replies

10. UNIX for Beginners Questions & Answers

Compare two variables and print the difference

compare two variables and print the difference i have two variables X1=rac1,rac2 Y1=rac2,rac3 output=rac1,rac3 Use code tags to wrap code fragments or data samples. (1 Reply)
Discussion started by: jhonnyrip
1 Replies
MOTO(9.1)																 MOTO(9.1)

NAME
moto - create animation scripts SYNOPSIS
fb/moto [ -fstart end ] [ -sskip ] [ file [ arg ... ] ] DESCRIPTION
Moto is a command generator tailored for an animator's needs. Its input is a concise description of the animation to be produced; its out- put is a command file suitable for input to rc or some other command interpreter. Its arguments are an optional file name containing a moto program (default standard input) and list of numeric parameters that are made available to the program. A moto program consists of a list of groups of commands guarded by a range of frames. Groups may contain parameter ranges enclosed in brackets []. For each frame, moto checks each group and processes those whose guards include the current frame number: 1,6: clr 128 1,4: clr -w [0,30] [0,30] [100,130] [100,130] 3,6: clr -w [100,70] [100,70] [130,100] [130,100] 255 This generates clr 128 clr -w 0 0 100 100 clr 128 clr -w 10 10 110 110 clr 128 clr -w 20 20 120 120 clr -w 100 100 130 130 255 clr 128 clr -w 30 30 130 130 clr -w 90 90 120 120 255 clr 128 clr -w 80 80 110 110 255 clr 128 clr -w 70 70 100 100 255 Two special guards, BEGIN and END, specify actions to be taken before and after processing frames. Moto allows complex computations inside parameter brackets: 1,10: clr [127.5*(1-cos([0,360]))] This generates clr 0 clr 29.82933350233 clr 105.35985734747 clr 191.25 clr 247.3108091502 clr 247.3108091502 clr 191.25 clr 105.35985734747 clr 29.82933350233 clr 0 Expressions may include constants and variables. All values are double-precision floating point numbers. The operators =, /, +, - (both unary and binary), <, >, <=, >=, ==, !=, ?: and !, all with their meanings as in C, except that all results are coerced to double. The result of a%b is a-b*(int)(a/b). The result of a&&b is a?b:a. The result of a||b is a?a:b. The exponentiation operator is ^, also writ- ten **. The expression [a,b] varies from a to b, linearly as the frame number varies between the guards of the group containing the expression. The expression a[b,c] has the value a*b+(1-a)*c. Its value varies from b to c as a varies from 0 to 1. The expression $i has the value of the i'th parameter following the file name on moto's command line. The precedence of operators is, from lowest to highest: = ? : || && < <= == != > >= + - * / % [ ] ^ ** - (unary) ! $ Expressions may be parenthesized to alter precedence. The following math functions are available: fabs floor ceil sqrt hypot sin cos tan asin acos atan exp log log10 sinh cosh tanh All math functions are as described in the C library, except that angles are measured in degrees rather than radians for the trig and inverse trig functions. In addition hypot may have two or three arguments, atan may take two arguments instead of one, and may also be spelled atan2. For parameterization, and to allow even more complex computations, moto has variables, assignment and computation groups. A computation group causes no output; rather its body is a group of expressions to be evaluated for their side effects. It is distinguished from a com- mand group by having a double colon separating the guard and body: BEGIN:: n=5 1,n:: x=512*sin([0,90]) 1,n: pcp -w 0 0 [x] 488 pic.[1,n] %0 This generates pcp -w 0 0 0 488 pic.1 %0 pcp -w 0 0 195.93391737093 488 pic.2 %0 pcp -w 0 0 362.03867196751 488 pic.3 %0 pcp -w 0 0 473.02632064578 488 pic.4 %0 pcp -w 0 0 512 488 pic.5 %0 Upon occasion it is useful to split moto's output into several files, under program control. A group that is separated from its guards by an at-sign @ instead of a colon names a file into which subsequent output is to be written. For example, 1,5@ file.[1,5] 1,5: This is file.[1,5]. creates 5 files, with names file.1, ..., file.5. Each file's contents will announce its name. As is true for all sufficiently large programs, moto has a shell escape. The text of a group separated from its guards by an exclamation point ! causes a copy of rc(1) to be started. The group's text is sent to rc's standard input, and its standard output inserted into moto's output. SOURCE
/sys/src/fb/moto.y MOTO(9.1)
All times are GMT -4. The time now is 05:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy