Sponsored Content
Top Forums Shell Programming and Scripting Negative number comparison using nawk on Linux Post 302849581 by Scott on Monday 2nd of September 2013 10:41:16 AM
Old 09-02-2013
That is odd, though I'm sure there's a perfectly reasonable explanation!

Have you made any efforts to debug the code?

i.e. it would be helpful if you showed where the variables new_price and MIN_PRICE (not the same as min_price!) are declared and set, as well as printing their values before the offending print statement.
 

10 More Discussions You Might Find Interesting

1. Programming

C++ how to isdigit() a negative number?

hi people, I have a function which I am passing a stream which is basically postfix notation if(isdigit(in.peek())) { in >> number; nums.push(number); } else if (strchr("+-*/", in.peek( )) != NULL) { in >> symbol; do_operation(symbol, nums, okay); } ... (1 Reply)
Discussion started by: Darklight
1 Replies

2. Shell Programming and Scripting

Grep for a negative number

Hi, I want to search for a return code of -3. Using grep "-3" *.* is giving a syntax error. Please suggest as to how can we search for this pattern using grep. Thanks, Krishna (2 Replies)
Discussion started by: kzmatam
2 Replies

3. Shell Programming and Scripting

ignore negative number in script

Hi, does anyone know how to ignore whether a number is negative in a script. E.g. if I have a variable that contains -1200, how do I ignore the minus sign? (1 Reply)
Discussion started by: borderblaster
1 Replies

4. HP-UX

Division returning a negative number

Hi All, Just faced an interesting thing in HP-UX. I was dividing 2955334616 / 2 by using echo `expr 2955334616 / 2` , and this ofcourse which expects 1477667308 to be returned. But I am getting -669816340 and I am :wall: how exactly this is possible. It is not one of the compliments (Ones or... (4 Replies)
Discussion started by: mail2sanand
4 Replies

5. Shell Programming and Scripting

Taking largest (negative) number from column of coordinates and adding positive form to every other

Hello all, I'm new to the forums and hope to be able to contribute something useful in the future; however I must admit that what has prompted me to join is the fact that currently I need help with something that has me at the end of my tether. I have a PDB (Protein Data Bank) file which I... (13 Replies)
Discussion started by: crunchgargoyle
13 Replies

6. Shell Programming and Scripting

comparison of number in linux..

hi all experts, i=1; while do echo $i $i=$i+1 done can I use min=2 max=5 if (($min > $ max)) then else (2 Replies)
Discussion started by: hamnsan
2 Replies

7. Shell Programming and Scripting

Grep for the most negative number

Hello, I am trying to write a bash script which will give me the most negative number. Here is an example input: Ce 3.7729752124 -4.9505731588 -4.1061257680 Ce -6.9156611391 -0.5991784762 7.3051893138 Ce 7.6489739875 0.3513020731 ... (6 Replies)
Discussion started by: sdl27789
6 Replies

8. Shell Programming and Scripting

Print smallest negative number with corresponding index from a column

considering the following table: ID col1 col2 col3 col4 1 -16.06801249 13.49785832 -56.57087607 -27.00500526 2 -1.53315720 0.71731735 -42.03602078 -39.78554623 3 -1.53315190 0.71731587 -42.03601548 ... (3 Replies)
Discussion started by: Birda
3 Replies

9. Shell Programming and Scripting

Is it possible to Divide a negative number in bash script

I am using a small script to divide some numbers in a given file and display the output in another file. I am getting the following error basename: invalid option -- '5' Try `basename --help' for more information. (standard_in) 1: syntax error The script is : #!/bin/bash for i in `cat... (4 Replies)
Discussion started by: kmnr877
4 Replies

10. UNIX for Beginners Questions & Answers

Converting negative number to positive in a file

Hi ALL, I am having semi column separated file as below. I am having negative values for the records starting with 11095. How can I convert that positive number I tried this below seems not working sed 's/ \(*\)$/ -\1/;t;s/\(.*\)-/\1/ myfile myfile... (6 Replies)
Discussion started by: arunkumar_mca
6 Replies
Data::Printer::Filter::DB(3pm)				User Contributed Perl Documentation			    Data::Printer::Filter::DB(3pm)

NAME
Data::Printer::Filter::DB - pretty printing database objects SYNOPSIS
In your program: use Data::Printer filters => { -external => [ 'DB' ], }; or, in your ".dataprinter" file: { filters => { -external => [ 'DB' ], }; DESCRIPTION
This is a filter plugin for Data::Printer. It filters through DBI's handlers (dbh) and statement (sth) objects displaying relevant information for the user. DBI is an extremely powerful and complete database interface. But it does a lot of magic under the hood, making their objects somewhat harder to debug. This filter aims to fix that :) For instance, say you want to debug something like this: use DBI; my $dbh = DBI->connect('dbi:DBM(RaiseError=1):', undef, undef ); A regular Data::Dumper output gives you absolutely nothing: $VAR1 = bless( {}, 'DBI::db' ); Data::Printer makes it better, but only to debug the class itself, not helpful at all to see its contents and debug your own code: DBI::db { Parents DBI::common Linear @ISA DBI::db, DBI::common public methods(48) : begin_work, clone, column_info, commit, connected, data_sources, disconnect, do, foreign_key_info, get_info, last_insert_id, ping, prepare, prepare_cached, preparse, primary_key, primary_key_info, quote, quote_identifier, rollback, rows, selectall_arrayref, selectall_hashref, selectcol_arrayref, selectrow_array, selectrow_arrayref, selectrow_hashref, sqlite_backup_from_file, sqlite_backup_to_file, sqlite_busy_timeout, sqlite_collation_needed, sqlite_commit_hook, sqlite_create_aggregate, sqlite_create_collation, sqlite_create_function, sqlite_enable_load_extension, sqlite_last_insert_rowid, sqlite_progress_handler, sqlite_register_fts3_perl_tokenizer, sqlite_rollback_hook, sqlite_set_authorizer, sqlite_update_hook, statistics_info, table_info, tables, take_imp_data, type_info, type_info_all private methods(0) internals: { } } Fear no more! If you use this filter, here's what you'll see: SQLite Database Handle (connected) { dbname: file.db Auto Commit: 1 Statement Handles: 0 Last Statement: - } Much better, huh? :) Statement handlers are even better. Imagine you continued your code with something like: my $sth = $dbh->prepare('SELECT * FROM foo WHERE bar = ?'); $sth->execute(42); With this filter, instead of an empty dump or full method information, you'll get exactly what you came for: SELECT * FROM foo WHERE bar = ? (42) Note that if your driver does not support holding of parameter values, you'll get a "bindings unavailable" message instead of the bound values. SEE ALSO
Data::Printer perl v5.14.2 2011-05-30 Data::Printer::Filter::DB(3pm)
All times are GMT -4. The time now is 06:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy