Sponsored Content
Top Forums Shell Programming and Scripting Emulate group-by in shell script Post 302994409 by vgersh99 on Wednesday 22nd of March 2017 02:12:39 PM
Old 03-22-2017
awk -F, -f muk.awk myFile OFS=, where muk.awk is:
Code:
FNR>1 {
   if (!($1 in amin))
       amin[$1]=amax[$1]=$2
   else {
      if($2<amin[$1]) amin[$1]=$2
      if($2>amax[$1]) amax[$1]=$2
   }
}
END {
  for (i in amin)
    print i,amin[i], amax[i]
}

This User Gave Thanks to vgersh99 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to emulate ls -lh?

Does anyone have a script they would like to share that emulates "ls -lh" in ksh on Solaris 8? Yeah, I know. Real men don't need that wimpy "h." Well, I'm a wimp. ;) (0 Replies)
Discussion started by: shew01
0 Replies

2. Shell Programming and Scripting

Shell quiz: emulate an associative array

Most shells flavors do not have associative arrays a.k.a. maps. How would you emulate an associative array? I had this problem once and found a working solution, but I don't want to spoil the game hence I wont tell it. Wonder if anyone comes up with something better. (5 Replies)
Discussion started by: colemar
5 Replies

3. Shell Programming and Scripting

HELP! Group by in shell script (awk/sed?)

Hello, Could some expert soul please help me with this? I have following file format - task time abc 5 xyz 4 abc 5 xyz 3 ddd 10 ddd 2 I need to generate output as - task ... (5 Replies)
Discussion started by: sncoupons
5 Replies

4. Shell Programming and Scripting

How to emulate ^S/^Q from a script

Hi, I wrote a little menu script that searches through another script you specify and displays step-names and next to it the text of the step. The scripts are converted JCL from mainframe. It alows you to select steps you want and will then create a new script which includes only the steps you... (5 Replies)
Discussion started by: AliceD
5 Replies

5. Shell Programming and Scripting

Shell script to rename a group of files

Hello, I am having 1800 files in a directory with a specified format, like amms_850o_prod.000003uNy amms_850o_prod.000003u8x amms_850o_prod.000003taP amms_850o_prod.000003tKy amms_850o_prod.000003si4 amms_850o_prod.000003sTP amms_850o_prod.000003sBg amms_850o_prod.000003rvx... (12 Replies)
Discussion started by: atlantis
12 Replies

6. Shell Programming and Scripting

"group by" using shell script?

not sure if it's called "group by" , but what i'm going to do is like this: i have a file below: 192.168.1.10 192.168.1.10 192.168.1.10 192.168.1.11 192.168.1.15 192.168.1.15 192.168.1.20 192.168.1.22 then i hope to get the result like this: 192.168.1.10 : 3 192.168.1.11 : 1... (6 Replies)
Discussion started by: tiger2000
6 Replies

7. Shell Programming and Scripting

Shell Script to ignore # and take corresponding user and group

Hi, I have a following file: role.IMPACT_USER.user=admin role.IMPACT_USER.user=dd12345 role.IMPACT_USER.user=ss76767 #role.IMPACT_USER.user=root #role.IMPACT_USER.group=System role.IMPACT_USER.group=ImpactUser #Description: Allow users to login in to Impact, start and stop service... (5 Replies)
Discussion started by: dbashyam
5 Replies

8. Shell Programming and Scripting

Emulate fgrep -f in perl

Is there any equivalent of the below requirement in perl fgrep -f file1 file2 > file3 (2 Replies)
Discussion started by: aravindj80
2 Replies

9. Shell Programming and Scripting

Shell script - group by

Hi, I have text file as shown below. root 25 oracle 25 batch 30 griduser 32 admin 35 root 25 oracle 25 batch 30 griduser 32 oracle 25 batch 30 griduser 32 xuser 45 admin 35 I want to group by based on user name, and the output need to be as below. Not necessary the username to be... (10 Replies)
Discussion started by: baladelaware73
10 Replies

10. Shell Programming and Scripting

Shell Script to Group by Based on Multiple Fields in a file

Hi, I want to know if there is any simple approach to SUM a field based on group by of different fields for e.g. file1.txt contains below data 20160622|XXX1||50.00||50.00|MONEY|Plan1| 20160622|XXX1||100.00||100.00|MONEY|Plan1| 20160623|XXX1||25.00||25.00|MONEY|Plan1|... (3 Replies)
Discussion started by: cnu_theprince
3 Replies
IEEE8021_AMRR(9)					   BSD Kernel Developer's Manual					  IEEE8021_AMRR(9)

NAME
ieee80211_amrr -- 802.11 network driver transmit rate control support SYNOPSIS
#include <net80211/ieee80211_amrr.h> void ieee80211_amrr_init(struct ieee80211_amrr *, struct ieee80211vap *, int amin, int amax, int interval); void ieee80211_amrr_cleanup(struct ieee80211_amrr *); void ieee80211_amrr_setinterval(struct ieee80211_amrr *, int interval); void ieee80211_amrr_node_init(struct ieee80211_amrr *, struct ieee80211_amrr_node *, struct ieee80211_node *); int ieee80211_amrr_choose(struct ieee80211_node *, struct ieee80211_amrr_node *); void ieee80211_amrr_tx_complete(struct ieee80211_amrr_node *, int ok, int retries); void ieee80211_amrr_tx_update(struct ieee80211_amrr_node *, int txnct, int success, int retrycnt); DESCRIPTION
ieee80211_amrr is an implementation of the AMRR transmit rate control algorithm for drivers that use the net80211 software layer. A rate control algorithm is responsible for choosing the transmit rate for each frame. To maximize throughput algorithms try to use the highest rate that is appropriate for the operating conditions. The rate will vary as conditions change; the distance between two stations may change, transient noise may be present that affects signal quality, etc. ieee80211_amrr uses very simple information from a driver to do it's job: whether a frame was successfully delivered and how many transmit attempts were made. While this enables its use with virtually any wireless device it limits it's effectiveness--do not expect it to function well in difficult environments and/or respond quickly to changing conditions. ieee80211_amrr requires per-vap state and per-node state for each station it is to select rates for. The API's are designed for drivers to pre-allocate state in the driver-private extension areas of each vap and node. For example the ral(4) driver defines a vap as: struct rt2560_vap { struct ieee80211vap ral_vap; struct ieee80211_beacon_offsets ral_bo; struct ieee80211_amrr amrr; int (*ral_newstate)(struct ieee80211vap *, enum ieee80211_state, int); }; The amrr structure member holds the per-vap state for ieee80211_amrr and ral(4) initializes it in the vap create method with: ieee80211_amrr_init(&rvp->amrr, vap, IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD, IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD, 500 /* ms */); The node is defined as: struct rt2560_node { struct ieee80211_node ni; struct ieee80211_amrr_node amrr; }; with initialization done in the driver's iv_newassoc method: static void rt2560_newassoc(struct ieee80211_node *ni, int isnew) { struct ieee80211vap *vap = ni->ni_vap; ieee80211_amrr_node_init(&RT2560_VAP(vap)->amrr, &RT2560_NODE(ni)->amrr, ni); } Once ieee80211_amrr state is setup, transmit rates are requested by calling ieee80211_amrr_choose() in the transmit path; e.g.: tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { rate = tp->mcastrate; } else if (m0->m_flags & M_EAPOL) { rate = tp->mgmtrate; } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { rate = tp->ucastrate; } else { (void) ieee80211_amrr_choose(ni, &RT2560_NODE(ni)->amrr); rate = ni->ni_txrate; } Note a rate is chosen only for unicast data frames when a fixed transmit rate is not configured; the other cases are handled with the net80211 transmit parameters. Note also that ieee80211_amrr_choose() writes the chosen rate in ni_txrate; this eliminates copying the value as it is exported to user applications so they can display the current transmit rate in status. The remaining work a driver must do is feed status back to ieee80211_amrr when a frame transmit completes using ieee80211_amrr_tx_complete(). Drivers that poll a device to retrieve statistics can use ieee80211_amrr_tx_update() (instead or in addition). SEE ALSO
ieee80211(9), ieee80211_output(9) BSD
August 4, 2009 BSD
All times are GMT -4. The time now is 10:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy