04-08-2011
Moderative interlude
Quote:
Originally Posted by
lowprofile
crap.
Spare us the insults. Actually gus2000 is entitled to assume you let others do your homework here and IMHO he is probably correct - from what i have seen here and over the years before this sure looks like homework.
Quote:
Originally Posted by
lowprofile
you if dont have anything to offer dont say nothin.
Sorry to say that but your grammar skills seem to match your scripting proficiency.
Quote:
Originally Posted by
lowprofile
Do i have to tell you how much effort i have put in before trying to seek help from the forum?
It may be news to you but the answer is actually: YES! We are neither a help desk nor a "we-will-do-your-work-for-you-for-free"-agency. We take proud in helping people to help themselves and usually tell them where they went wrong in
their own efforts at solving the problem instead of solving the problem
for them.
For this to happen it would have been imperative to post what you have tried instead of exposing yourself to be what you probably are (and what gus2000 supposed you to be).
All in all: get better Unix skills, get a better attitude and you definitely get an infraction.
bakunin
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I was wondering if it's possible to use a command to get the first 3 characters of a line in a text file, I tried grep but it returns the whole line but I am only interested in the first 3 characters. Is this possible with grep or I need any other command?
Also is it possible deleting from... (2 Replies)
Discussion started by: g-e-n-o
2 Replies
2. UNIX for Dummies Questions & Answers
give this a try and let me know if it works
grep '^' filename
rachael (2 Replies)
Discussion started by: rachael
2 Replies
3. Shell Programming and Scripting
Dear All,
I have a log file that is dislpayed as:
<msg time='2009-10-14T05:46:42.580+00:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='mtdb_a'
host_addr='UNKNOWN' version='1'>
<txt>14-OCT-2009 05:46:42 *... (19 Replies)
Discussion started by: x-plicit78
19 Replies
4. Shell Programming and Scripting
Guys ..
Need to pull this highlighted strings irrespective of line numbers & should be echoed . But these strings are from Outfile from different dir. In which way this can be grepped ?? Need an idea
http-timeout 120 seconds
persistent-timeout 180 seconds
host-rewriting on
... (7 Replies)
Discussion started by: raghunsi
7 Replies
5. Shell Programming and Scripting
I have a list of fields that I want to check a file for, returning that field if it not found at all in the file. Is there a way to do a grep -lc and return the passed variable too rather then just the count?
I am doing some crappy work-around now but I was not sure how to regrep this for :0 so... (3 Replies)
Discussion started by: personalt
3 Replies
6. Shell Programming and Scripting
Hi All,
I'm trying to grep for 3 patterns in a string of gibberish. It so happens that each line is appended by a date/time stamp and i was able to figure out how to extract only the datetime.
here is the string..
i have to display
tinker tailor soldier spy
Please can some help... (2 Replies)
Discussion started by: Irishboy24
2 Replies
7. Shell Programming and Scripting
Hi All,
I need to recursively grep several folders for a MAC address and display the results with the date of the file name at the start. Even better would be if the final results were displayed chronologically so the newest file is always at the end. Oldest at the top, regardless of what... (8 Replies)
Discussion started by: quemalr
8 Replies
8. AIX
Hi All,
I am new to AIX unix . i need to grep for a pattern and if pattern is found then i need 3 before the pattern line found and 3 lines after the pattern found. (11 Replies)
Discussion started by: coolvibh
11 Replies
9. Shell Programming and Scripting
Hi Folks,
I have a log file at the following location..
/opt/ert/abc.log
Now abc.log contain the following enteries in this format below..
23-Jul-2014 10:09.32.204 ERROR abc.log cdfrer tyre fgty >>>>> cqno : 78539132 abc Id : 0 Sabc : 20140724
Now in log file (abc.log) I want to... (2 Replies)
Discussion started by: tuntun343466
2 Replies
10. Shell Programming and Scripting
So I'm stumped.
First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes.
I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies
math::fuzzy(3tcl) Tcl Math Library math::fuzzy(3tcl)
__________________________________________________________________________________________________________________________________________________
NAME
math::fuzzy - Fuzzy comparison of floating-point numbers
SYNOPSIS
package require Tcl ?8.3?
package require math::fuzzy ?0.2?
::math::fuzzy::teq value1 value2
::math::fuzzy::tne value1 value2
::math::fuzzy::tge value1 value2
::math::fuzzy::tle value1 value2
::math::fuzzy::tlt value1 value2
::math::fuzzy::tgt value1 value2
::math::fuzzy::tfloor value
::math::fuzzy::tceil value
::math::fuzzy::tround value
::math::fuzzy::troundn value ndigits
_________________________________________________________________
DESCRIPTION
The package Fuzzy is meant to solve common problems with floating-point numbers in a systematic way:
o Comparing two numbers that are "supposed" to be identical, like 1.0 and 2.1/(1.2+0.9) is not guaranteed to give the intuitive
result.
o Rounding a number that is halfway two integer numbers can cause strange errors, like int(100.0*2.8) != 28 but 27
The Fuzzy package is meant to help sorting out this type of problems by defining "fuzzy" comparison procedures for floating-point numbers.
It does so by allowing for a small margin that is determined automatically - the margin is three times the "epsilon" value, that is three
times the smallest number eps such that 1.0 and 1.0+$eps canbe distinguished. In Tcl, which uses double precision floating-point numbers,
this is typically 1.1e-16.
PROCEDURES
Effectively the package provides the following procedures:
::math::fuzzy::teq value1 value2
Compares two floating-point numbers and returns 1 if their values fall within a small range. Otherwise it returns 0.
::math::fuzzy::tne value1 value2
Returns the negation, that is, if the difference is larger than the margin, it returns 1.
::math::fuzzy::tge value1 value2
Compares two floating-point numbers and returns 1 if their values either fall within a small range or if the first number is larger
than the second. Otherwise it returns 0.
::math::fuzzy::tle value1 value2
Returns 1 if the two numbers are equal according to [teq] or if the first is smaller than the second.
::math::fuzzy::tlt value1 value2
Returns the opposite of [tge].
::math::fuzzy::tgt value1 value2
Returns the opposite of [tle].
::math::fuzzy::tfloor value
Returns the integer number that is lower or equal to the given floating-point number, within a well-defined tolerance.
::math::fuzzy::tceil value
Returns the integer number that is greater or equal to the given floating-point number, within a well-defined tolerance.
::math::fuzzy::tround value
Rounds the floating-point number off.
::math::fuzzy::troundn value ndigits
Rounds the floating-point number off to the specified number of decimals (Pro memorie).
Usage:
if { [teq $x $y] } { puts "x == y" }
if { [tne $x $y] } { puts "x != y" }
if { [tge $x $y] } { puts "x >= y" }
if { [tgt $x $y] } { puts "x > y" }
if { [tlt $x $y] } { puts "x < y" }
if { [tle $x $y] } { puts "x <= y" }
set fx [tfloor $x]
set fc [tceil $x]
set rounded [tround $x]
set roundn [troundn $x $nodigits]
TEST CASES
The problems that can occur with floating-point numbers are illustrated by the test cases in the file "fuzzy.test":
o Several test case use the ordinary comparisons, and they fail invariably to produce understandable results
o One test case uses [expr] without braces ({ and }). It too fails.
The conclusion from this is that any expression should be surrounded by braces, because otherwise very awkward things can happen if you
need accuracy. Furthermore, accuracy and understandable results are enhanced by using these "tolerant" or fuzzy comparisons.
Note that besides the Tcl-only package, there is also a C-based version.
REFERENCES
Original implementation in Fortran by dr. H.D. Knoble (Penn State University).
P. E. Hagerty, "More on Fuzzy Floor and Ceiling," APL QUOTE QUAD 8(4):20-24, June 1978. Note that TFLOOR=FL5 took five years of refereed
evolution (publication).
L. M. Breed, "Definitions for Fuzzy Floor and Ceiling", APL QUOTE QUAD 8(3):16-23, March 1978.
D. Knuth, Art of Computer Programming, Vol. 1, Problem 1.2.4-5.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math ::
fuzzy of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may
have for either package and/or documentation.
KEYWORDS
floating-point, math, rounding
CATEGORY
Mathematics
math 0.2 math::fuzzy(3tcl)