Sponsored Content
Top Forums Shell Programming and Scripting Why result is wrong here ? whether break statement is wrong ? Post 302778389 by Chubler_XL on Sunday 10th of March 2013 11:31:22 PM
Old 03-11-2013
28.4 - 28.5 < 0.10 If you want to print the 28.5 record also, move test to after print:

Code:
awk 'FNR==1{i++}{LC[i]=NR} 
{for(k=1; k<=NF; k++)A[i,FNR,k]=$k}     #ARRAY                           
END{
    j=1;
    while(j<=LC[1])                # IF J<=Line Count do following
    {
       x=A[1,j,2]-A[1,1,2]
       print x,j,A[1,j,2],A[1,j,1]
       if(x>=0.1)break
       j++
}}' OFS="\t" test.txt

This also produces the same output:
Code:
awk '!s{s=$2}
{print $2-s,j++,$2,$1}
$2>s{exit}' OFS="\t" test.txt


Last edited by Chubler_XL; 03-11-2013 at 12:41 AM.. Reason: Added equilivent simple code
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What's wrong with this simple statement?

I know that this is a ridiculously simple statement, but I am getting an error when I execute it, and I can't figure out what it is. Can anyone point me in the right direction? #!/bin/ksh integer dateMonth=0 integer intZero=0 if then dateMonth = 1 fi echo $dateMonth (7 Replies)
Discussion started by: mharley
7 Replies

2. Shell Programming and Scripting

whats wrong with this find statement ?

cmd="find /a/technologies -name '*.jar' | grep \"Tuning/specificloader/lib\"" echo $cmd for index in `$cmd` do SL_JARS="${SL_JARS}:${index}" done gives error ==> find: paths must precede expression Usage: find but for index in... (2 Replies)
Discussion started by: crackthehit007
2 Replies

3. Shell Programming and Scripting

Something is wrong with this switch( case statement.

I started writing a script to save the files from a camera I got the other day, which mounts in /Volumes , and I got into it and started building this menu. The only problem is that the switch case is coming up as a syntax error at the parenthesis after a case. Here is the code: while : do ... (2 Replies)
Discussion started by: snakemasterAK
2 Replies

4. Shell Programming and Scripting

What's wrong with the do statement?

hi guys, here's the code $ cat getsums.sh #!/usr/bin/sh FILENAME=$1 DELIMITER=$2 FIRST_COL=$3 SECOND_COL=$4 SALESDATE_COL=$5 STOREID=$6 UPC=$7 GTIN=$8 PROMOID=$9 echo "" echo ".:Summation Tool:." for FILE in ${FILENAME} do (7 Replies)
Discussion started by: ramneim
7 Replies

5. Shell Programming and Scripting

What is wrong with this awk statement?

echo $line | awk -F, "BEGIN {if(NF==10) && /'"${MONTH}"' '"${DAY}"' '"${TIMEH}:"'/,0 {print $10"-"$4} else {print $13"-"$4}}" if the fields in the line is equal to 10, print the values of this specified fields "$10 and $4". if the fields in the line is anything but 10, print the values of... (5 Replies)
Discussion started by: SkySmart
5 Replies

6. Shell Programming and Scripting

Wrong result return from script

Hi Gurus, I need a script to compare two files: sample file like below: list: cde,file4 cde,file5 def,file6 def,file7 def,file8 abc,file1 abc,file2 abc,file3 acd,file9 acd,file10 tmp file1 file2 file3 file4 (12 Replies)
Discussion started by: ken6503
12 Replies

7. Shell Programming and Scripting

Output result with break line

Hello, I am coding a script to check mysql databases using bash script, I would like to check if the status of a table is not 'OK', will return the table name and do some more actions: check.log table1 OK table2 Some error here table3 ... (5 Replies)
Discussion started by: Abu Rayane
5 Replies

8. Programming

Whats wrong with this If statement?

Hi I am pretty new to bash scripting.I am trying to write the if statement in bash and it give me error. Can you please help me what I am doing wrong in If statement? Code: if && && then fector=$kk; divide=$DB_SIZE/$kk; echo "factor value:$fector" echo"divide... (1 Reply)
Discussion started by: Gevni
1 Replies

9. UNIX for Beginners Questions & Answers

Whats wrong with this If statement?

Hi I am pretty new to bash scripting.I am trying to write the if statement in bash and it give me error. Can you please help me what I am doing wrong in If statement? if && && then fector=$kk; divide=$DB_SIZE/$kk; echo "factor value:$fector" echo"divide value:$divide"... (1 Reply)
Discussion started by: Gevni
1 Replies

10. Shell Programming and Scripting

Whats wrong with this If statement?

Hi I am pretty new to bash scripting.I am trying to write the if statement in bash and it give me error. Can you please help me what I am doing wrong in If statement? if && && then fector=$kk; divide=$DB_SIZE/$kk; echo "factor value:$fector" echo"divide value:$divide"... (4 Replies)
Discussion started by: Gevni
4 Replies
Tcl_WrongNumArgs(3)                                           Tcl Library Procedures                                           Tcl_WrongNumArgs(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_WrongNumArgs - generate standard error message for wrong number of arguments SYNOPSIS
#include <tcl.h> Tcl_WrongNumArgs(interp, objc, objv, message) ARGUMENTS
Tcl_Interp interp (in) Interpreter in which error will be reported: error message gets stored in its result object. int objc (in) Number of leading arguments from objv to include in error message. Tcl_Obj *const objv[] (in) Arguments to command that had the wrong number of arguments. const char *message (in) Additional error information to print after leading arguments from objv. This typically gives the acceptable syntax of the command. This argument may be NULL. _________________________________________________________________ DESCRIPTION
Tcl_WrongNumArgs is a utility procedure that is invoked by command procedures when they discover that they have received the wrong number of arguments. Tcl_WrongNumArgs generates a standard error message and stores it in the result object of interp. The message includes the objc initial elements of objv plus message. For example, if objv consists of the values foo and bar, objc is 1, and message is "fileName count" then interp's result object will be set to the following string: wrong # args: should be "foo fileName count" If objc is 2, the result will be set to the following string: wrong # args: should be "foo bar fileName count" Objc is usually 1, but may be 2 or more for commands like string and the Tk widget commands, which use the first argument as a subcommand. Some of the objects in the objv array may be abbreviations for a subcommand. The command Tcl_GetIndexFromObj will convert the abbreviated string object into an indexObject. If an error occurs in the parsing of the subcommand we would like to use the full subcommand name rather than the abbreviation. If the Tcl_WrongNumArgs command finds any indexObjects in the objv array it will use the full subcommand name in the error message instead of the abbreviated name that was originally passed in. Using the above example, let us assume that bar is actually an abbreviation for barfly and the object is now an indexObject because it was passed to Tcl_GetIndexFromObj. In this case the error message would be: wrong # args: should be "foo barfly fileName count" SEE ALSO
Tcl_GetIndexFromObj KEYWORDS
command, error message, wrong number of arguments Tcl 8.0 Tcl_WrongNumArgs(3)
All times are GMT -4. The time now is 12:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy