Sponsored Content
Full Discussion: awk array problem
Top Forums Shell Programming and Scripting awk array problem Post 302541017 by cmp260 on Friday 22nd of July 2011 08:08:04 AM
Old 07-22-2011
stats don't seem accurate

Hi,

here are stats for 4 days, they do not seem right. The numbers "in" and "out" should be quite similar but they are not.

Code:
Date @2011-07-17 COUNT -323 IN 7 OUT 334 Estimate 323 bats(peak was at 22:01:32)
Date @2011-07-18 COUNT +107 IN 401 OUT 1 Estimate 107 bats(peak was at 08:07:31)
Date @2011-07-19 COUNT +158 IN 463 OUT 1 Estimate 158 bats(peak was at 22:20:57)
Date @2011-07-20 COUNT +451 IN 453 OUT 0 Estimate 451 bats(peak was at 08:37:30)
A 6737
B 6344
T 13081
H  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
A 533 479 539 412 1179 314 82 49 29 27 20 16 12 11  9  3  7 43 83 141 278 1414 385
B 464 535 525 455 419 130 68 49 33 31 26 17 11 10  5  3 11 51 87 152 265 2136 535

I have attached the relevant files if you would't mind having a look to see?
many thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk array problem

hi i am trying to perform some calculations with awk and arrays. i have this so far: awk 'NR==FNR{ for(i=1; i<=NF; i++) {array+=$i} tot++;next} {for(i=1; i<=NF; i++) {avg=array/tot} {diff=(array - avg)}} {for(i=1; i<=NF; i++) {printf("%5.8f\n",diff)}}' "$count".txt "$count".ttt >... (4 Replies)
Discussion started by: npatwardhan
4 Replies

2. Shell Programming and Scripting

Problem with lookup values on AWK associative array

I'm at wits end with this issue and my troubleshooting leads me to believe it is a problem with the file formatting of the array referenced by my script: awk -F, '{if (NR==FNR) {a=$4","$3","$2}\ else {print a "," $0}}' WBTSassignments1.txt RNCalarms.tmp On the WBTSassignments1.txt file... (2 Replies)
Discussion started by: JasonHamm
2 Replies

3. Shell Programming and Scripting

AWK Array problem

Dear All, I am facing problem to get right output through awk program I have file in which “B” value is appearing multiple time and I need to capture all these values. My script is BEGIN { FS=" " } { if ( substr($1,1,5) == "START" ) { i =... (2 Replies)
Discussion started by: arvindng
2 Replies

4. Shell Programming and Scripting

AWK help. how to compare a variable with a data array in AWK?

Hi all, i have a data array as follows. array=ertfgj2345 array=456ttygkd . . . array=errdjt3235 so number or elements in the array can varies depending on how big the data input is. now i have a variable, and it is $1 (there are $2, $3 and so on, i am only interested in $1). ... (9 Replies)
Discussion started by: usustarr
9 Replies

5. Shell Programming and Scripting

Challenging Awk array problem

Hi, I rather have a very complicated awk problem here, at least to me. I have two files. File 1: 607 687 174 0 0 chr1 3000001 3000156 -194195276 - L1_Mur2 LINE L1 -4310 1567 1413 1 607 917 214 114 45 chr1 3000237 ... (19 Replies)
Discussion started by: polsum
19 Replies

6. Shell Programming and Scripting

Using awk array problem

I am trying to map values in the input file, where 2nd column depends on the specific value in the 1st column. When 1st column is A place 1 into 2nd column, when it is B, place 2, when C place 3, otherwise no change. My input: U |100|MAIN ST |CLMN1|1 A |200|GREEN LN |CLMN2|2 1 |12... (4 Replies)
Discussion started by: migurus
4 Replies

7. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

8. Shell Programming and Scripting

Problem with awk array when loading from shell variable

Hi, I have a problem with awk array when iam trying to use awk in solaris box as below..Iam unable to figure out the problem.. Need your help. is there any alternative to make it in arrays from variable values nawk 'BEGIN {SUBSEP=" "; split("101880|110045 101887|110045 101896|110045... (9 Replies)
Discussion started by: cskumar
9 Replies

9. Shell Programming and Scripting

How to Assign an shell array to awk array?

Hello All, Can you please help me with the below. #!/bin/bash ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1" ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
Discussion started by: Ariean
14 Replies

10. Shell Programming and Scripting

Index problem in associate array in awk

I am trying to reformat the table by filling any missing rows. The final table will have consecutive IDs in the first column. My problem is the index of the associate array in the awk script. infile: S01 36407 53706 88540 S02 69343 87098 87316 S03 50133 59721 107923... (4 Replies)
Discussion started by: yifangt
4 Replies
WUMP(6) 							 BSD Games Manual							   WUMP(6)

NAME
wump -- hunt the wumpus in an underground cave SYNOPSIS
wump [-h] [-a arrows] [-b bats] [-p pits] [-r rooms] [-t tunnels] DESCRIPTION
The game wump is based on a fantasy game first presented in the pages of People's Computer Company in 1973. In Hunt the Wumpus you are placed in a cave built of many different rooms, all interconnected by tunnels. Your quest is to find and shoot the evil Wumpus that resides elsewhere in the cave without running into any pits or using up your limited supply of arrows. The options are as follows: -a Specifies the number of magic arrows the adventurer gets. The default is five. -b Specifies the number of rooms in the cave which contain bats. The default is three. -h Play the hard version -- more pits, more bats, and a generally more dangerous cave. -p Specifies the number of rooms in the cave which contain bottomless pits. The default is three. -r Specifies the number of rooms in the cave. The default cave size is twenty rooms. -t Specifies the number of tunnels connecting each room in the cave to another room. Beware, too many tunnels in a small cave can eas- ily cause it to collapse! The default cave room has three tunnels to other rooms. While wandering through the cave you'll notice that, while there are tunnels everywhere, there are some mysterious quirks to the cave topol- ogy, including some tunnels that go from one room to another, but not necessarily back! Also, most pesky of all are the rooms that are home to large numbers of bats, which, upon being disturbed, will en masse grab you and move you to another portion of the cave (including those housing bottomless pits, sure death for unwary explorers). Fortunately, you're not going into the cave without any weapons or tools, and in fact your biggest aids are your senses; you can often smell the rather odiferous Wumpus up to two rooms away, and you can always feel the drafts created by the occasional bottomless pit and hear the rustle of the bats in caves they might be sleeping within. To kill the wumpus, you'll need to shoot it with one of your magic arrows. Fortunately, you don't have to be in the same room as the crea- ture, and can instead shoot the arrow from as far as three or four rooms away! When you shoot an arrow, you do so by typing in a list of rooms that you'd like it to travel to. If at any point in its travels it cannot find a tunnel to the room you specify from the room it's in, it will instead randomly fly down one of the tunnels, possibly, if you're real unlucky, even flying back into the room you're in and hitting you! BSD
January 19, 2006 BSD
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy