Sponsored Content
Top Forums Shell Programming and Scripting Using grep with test and without using [[ ]] Post 303029271 by Don Cragun on Thursday 24th of January 2019 05:16:31 AM
Old 01-24-2019
Quote:
Originally Posted by RudiC
How about introducing a "feeling" operator (but only for almost-integers)?
On the only 1's complement machines I've ever worked on (CDC 3600 and CDC 6500) you could have both -0 and +0. And if you used the machine language instructions to compare integer values, they tested equal (48-bit integers on the 3600 and 60-bit integers on the 6500). If you use the machine language instructions to compare their bitwise values, they tested unequal (since the sign bit was different).
These 2 Users Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using grep in a test/if statement

Okay, well this is more or less my first attempt at writing a shell script. Anyways, here's my code: cd ${PATH} if then rm ${FILE} ./anotherScript else exit 1 fi exit 1 Anyways, it's a pretty simple script that is supposed to search for the... (4 Replies)
Discussion started by: cbo0485
4 Replies

2. UNIX for Dummies Questions & Answers

Unix grep/test command

Hello, i have a script which checks if the user entered 8 numeric characters in the form of YYYYMMDD (birth date). If the user entered any non numeric characters, an error will be displayed: # Check to see if the 8 characters are all numbers # If not show error essage # And prompt user... (4 Replies)
Discussion started by: netmaster
4 Replies

3. Shell Programming and Scripting

Using grep inside a test

Hi, I want to use grep inside a test statement, but I am getting an error message. Two variables testvarNum=5 testvarNonNum=x echo $testvarNum | grep * The result of this is as follows: 5 However, when I try the following (i.e. to test if the variable is numeric or non-numeric):... (3 Replies)
Discussion started by: dkieran
3 Replies

4. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

5. Shell Programming and Scripting

grep functions, how to test if succeeded

Hello ...again. I am stuck on this part, I have a loop with processes an operations file. and calls different functions depending on what is in loop, which processes a database file... #so far my add function works as intended add() { ...blah blah; } # delete is kinda working... (13 Replies)
Discussion started by: gcampton
13 Replies

6. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

7. Shell Programming and Scripting

searching fileextentions (suffix) with grep and/or test

Hello, I have a problem. I will search files on fileextentions (suffix). It can with the command find, but I will do it with the commands grep and/or test. When i start the script I will see all files with that extention (suffix). Can anyone help me, please? Thanks! Regards, Arjan... (4 Replies)
Discussion started by: arjanengbers
4 Replies

8. Shell Programming and Scripting

If test grep.... always returns 0 status

Hi all. I am trying to compare and filter two files. I have a bigfile.txt of names and ids and a smallfile.txt of ids only. What I am trying to do is use a while read loop to read the ids in the bigfile and then echo the name and id only if the id exists in the small file. Basically, I'm trying to... (5 Replies)
Discussion started by: jameswatson3
5 Replies

9. Shell Programming and Scripting

Grep/print/ a test file

cat abc.txt Filename: SHA_AED_Monthly_SNR_20150331.txt.gz Data Format: ASCII with carriage returns and linefeeds Compression: GZIP GZIP Bytes: 36893068 Unzipped Bytes : 613794510 Records: 851310 Record Length: 738 Blocksize: 32472 Filename: SHA_AED_SNR_ChangeLog_20150331.txt.gz Data... (16 Replies)
Discussion started by: dotran
16 Replies

10. UNIX for Beginners Questions & Answers

Is it correct? if test grep EOF $a ...

read a if test grep EOF $a then echo yes file else echo no fi (1 Reply)
Discussion started by: iamsumibisht
1 Replies
Int64(3o)							   OCaml library							 Int64(3o)

NAME
Int64 - 64-bit integers. Module Module Int64 Documentation Module Int64 : sig end 64-bit integers. This module provides operations on the type int64 of signed 64-bit integers. Unlike the built-in int type, the type int64 is guaranteed to be exactly 64-bit wide on all platforms. All arithmetic operations over int64 are taken modulo 2^{64 Performance notice: values of type int64 occupy more memory space than values of type int , and arithmetic operations on int64 are gener- ally slower than those on int . Use int64 only when the application requires exact 64-bit arithmetic. val zero : int64 The 64-bit integer 0. val one : int64 The 64-bit integer 1. val minus_one : int64 The 64-bit integer -1. val neg : int64 -> int64 Unary negation. val add : int64 -> int64 -> int64 Addition. val sub : int64 -> int64 -> int64 Subtraction. val mul : int64 -> int64 -> int64 Multiplication. val div : int64 -> int64 -> int64 Integer division. Raise Division_by_zero if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for Pervasives.(/) . val rem : int64 -> int64 -> int64 Integer remainder. If y is not zero, the result of Int64.rem x y satisfies the following property: x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y) . If y = 0 , Int64.rem x y raises Division_by_zero . val succ : int64 -> int64 Successor. Int64.succ x is Int64.add x Int64.one . val pred : int64 -> int64 Predecessor. Int64.pred x is Int64.sub x Int64.one . val abs : int64 -> int64 Return the absolute value of its argument. val max_int : int64 The greatest representable 64-bit integer, 2^{63 - 1. val min_int : int64 The smallest representable 64-bit integer, -2^{63. val logand : int64 -> int64 -> int64 Bitwise logical and. val logor : int64 -> int64 -> int64 Bitwise logical or. val logxor : int64 -> int64 -> int64 Bitwise logical exclusive or. val lognot : int64 -> int64 Bitwise logical negation val shift_left : int64 -> int -> int64 Int64.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= 64 . val shift_right : int64 -> int -> int64 Int64.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64 . val shift_right_logical : int64 -> int -> int64 Int64.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x . The result is unspecified if y < 0 or y >= 64 . val of_int : int -> int64 Convert the given integer (type int ) to a 64-bit integer (type int64 ). val to_int : int64 -> int Convert the given 64-bit integer (type int64 ) to an integer (type int ). On 64-bit platforms, the 64-bit integer is taken modulo 2^{63, i.e. the high-order bit is lost during the conversion. On 32-bit platforms, the 64-bit integer is taken modulo 2^{31, i.e. the top 33 bits are lost during the conversion. val of_float : float -> int64 Convert the given floating-point number to a 64-bit integer, discarding the fractional part (truncate towards 0). The result of the con- version is undefined if, after truncation, the number is outside the range [ Int64.min_int , Int64.max_int ]. val to_float : int64 -> float Convert the given 64-bit integer to a floating-point number. val of_int32 : int32 -> int64 Convert the given 32-bit integer (type int32 ) to a 64-bit integer (type int64 ). val to_int32 : int64 -> int32 Convert the given 64-bit integer (type int64 ) to a 32-bit integer (type int32 ). The 64-bit integer is taken modulo 2^{32, i.e. the top 32 bits are lost during the conversion. val of_nativeint : nativeint -> int64 Convert the given native integer (type nativeint ) to a 64-bit integer (type int64 ). val to_nativeint : int64 -> nativeint Convert the given 64-bit integer (type int64 ) to a native integer. On 32-bit platforms, the 64-bit integer is taken modulo 2^{32. On 64-bit platforms, the conversion is exact. val of_string : string -> int64 Convert the given string to a 64-bit integer. The string is read in decimal (by default) or in hexadecimal, octal or binary if the string begins with 0x , 0o or 0b respectively. Raise Failure int_of_string if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int64 . val to_string : int64 -> string Return the string representation of its argument, in decimal. val bits_of_float : float -> int64 Return the internal representation of the given float according to the IEEE 754 floating-point ``double format'' bit layout. Bit 63 of the result represents the sign of the float; bits 62 to 52 represent the (biased) exponent; bits 51 to 0 represent the mantissa. val float_of_bits : int64 -> float Return the floating-point number whose internal representation, according to the IEEE 754 floating-point ``double format'' bit layout, is the given int64 . type t = int64 An alias for the type of 64-bit integers. val compare : t -> t -> int The comparison function for 64-bit integers, with the same specification as Pervasives.compare . Along with the type t , this function compare allows the module Int64 to be passed as argument to the functors Set.Make and Map.Make . OCamldoc 2012-06-26 Int64(3o)
All times are GMT -4. The time now is 06:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy