Sponsored Content
Top Forums Shell Programming and Scripting Why result is wrong here ? whether break statement is wrong ? Post 302778299 by Akshay Hegde on Sunday 10th of March 2013 10:16:14 AM
Old 03-10-2013
Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile

pls tell me why its resulting wrong

Code:
admin@IEEE:~/Desktop$ cat test.txt
0    28.4
5    28.4
10    28.4
15    28.5
20    28.5
25    28.6
30    28.6
35    28.7
40    28.7
45    28.7
50    28.8
55    28.8
60    28.8
65    28.1
70    26.5

This I tried

Code:
admin@IEEE:~/Desktop$ cat awk.sh
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]
if(x>=0.1)break
print x,j,A[1,j,2],A[1,j,1]
j++
}}' OFS="\t" test.txt

Resulting

Code:
admin@IEEE:~/Desktop$ sh awk.sh 
0    1    28.4    0
0    2    28.4    5
0    3    28.4    10

Here I actually require line No 4 record.

Last edited by Akshay Hegde; 03-10-2013 at 12:23 PM.. Reason: to comment
 

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
shares-admin(1) 						   User Commands						   shares-admin(1)

NAME
shares-admin - Enables the configuration of shared NFS / SMB directories. SYNOPSIS
shares-admin [--add-share=PATH] [gnome-std-options] DESCRIPTION
shares-admin enables a user to configure the sharing of directories / filesystems. These can be shared using either NFS or SAMBA. This is linked to the ability to right-click on a directory in Nautilus and select "Share folder". OPTIONS
The following options are supported: -a, --add-share=PATH Configure a share for the specified PATH. gnome-std-options Standard options available for use with most GNOME applications. See gnome-std-options(5) for more informa- tion. EXAMPLES
Example 1: Running the main application. example% shares-admin Example 2: Sharing a specific directory. example% shares-admin --add-share=/export/home/shared EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/shares-admin Executable for directory sharing configuration. /var/spool/setup-tool-backends/backup/shares Backup directory for files that are modified. /var/run/setup-tool-backends/debug/shares Debug logs can be found under here. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-system-tools | +-----------------------------+-----------------------------+ |Interface stability |Uncommitted | +-----------------------------+-----------------------------+ SEE ALSO
Latest version of the GNOME Desktop User Guide for your platform. users-admin(1), network-admin(1), services-admin(1), time-admin(1), gnome-std-options(5), attributes(5) NOTES
Written by Darren Kenny, Sun Microsystems Inc., 2006. SunOS 5.11 6 Nov 2006 shares-admin(1)
All times are GMT -4. The time now is 08:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy