Sponsored Content
Top Forums Shell Programming and Scripting Calculate data and make it into new column using awk Post 302524571 by pmm on Tuesday 24th of May 2011 12:05:37 AM
Old 05-24-2011
Code:
nawk '
{ A[FILENAME]+=$1; N[FILENAME]++ }
END { for ( i in A ) { REC=REC A[i]/N[i]" " }
        print REC } ' a1.txt a2.txt a3.txt

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Use awk to calculate average of column 3

Suppose I have 500 files in a directory and I need to Use awk to calculate average of column 3 for each of the file, how would I do that? (6 Replies)
Discussion started by: grossgermany
6 Replies

2. Shell Programming and Scripting

calculate the average of time series data using AWK

Hi, I have two time series data (below) merged into a file. t1 and t2 are in unit of second I want to calculate the average of V1 every second and count how many times "1" in V2 is occur within a second Input File: t1 V1 t2 V2 10.000000... (5 Replies)
Discussion started by: nica
5 Replies

3. Shell Programming and Scripting

repeated column data filter and make as a row

I need to get the output in row wise for the repeated column data Ex: Input: que = five ans = 5 que = six ans = 6 Required output: que = five six ans = 5 6 Any body can guide me?"""""" (2 Replies)
Discussion started by: vasanth_vadalur
2 Replies

4. Shell Programming and Scripting

trying to make an AWK code for ordering numbers in a column from least to highest

Hi all, I have a large column of numbers like 5.6789 2.4578 9.4678 13.5673 1.6589 ..... I am trying to make an awk code so that awk can easily go through the column and arrange the numbers from least to highest like 1.6589 2.4578 5.6789 ....... can anybody suggest, how can I do... (5 Replies)
Discussion started by: ananyob
5 Replies

5. Emergency UNIX and Linux Support

awk- add columns and make new column and save as newfile

Hi, I have file as below: 5 6 7 4 8 9 3 5 6 output needs to be another file with 4th column as $1+$2 and 5th column as $3+$4. sample output file 5 6 7 11 18 4 8 9 12 21 3 5 6 8 14 Anybody have answer Thanks in advance (3 Replies)
Discussion started by: vasanth.vadalur
3 Replies

6. Shell Programming and Scripting

Calculate difference between consecutive data points in a column from a file

Hi, I have a file with one column data (sample below) and I am trying to write a shell script to calculate the difference between consecutive data valuse i.e Var = Ni -N(i-1) 0.3141 -3.6595 0.9171 5.2001 3.5331 3.7022 -6.1087 -5.1039 -9.8144 1.6516 -2.725 3.982 7.769 8.88 (5 Replies)
Discussion started by: malandisa
5 Replies

7. Shell Programming and Scripting

using AWK to make four column to one column

Gurus, I have file contain following line. ,0113955056,,XAgent-Suspend ,0119418233,,XAgent-Suspend ,0102119078,,XAgent-Suspend I want to make it one column file. How to do this using awk? Can anyone help with 'awk' 0113955056 0119418233 0102119078 (5 Replies)
Discussion started by: thepurple
5 Replies

8. Shell Programming and Scripting

Calculate 2nd Column Based on 1st Column

Dear All, I have input file like this. input.txt CE2_12-15 3950.00 589221.0 9849709.0 768.0 CE2_12_2012 CE2_12-15 3949.00 589199.0 9849721.0 768.0 CE2_12_2012 CE2_12-15 3948.00 589178.0 9849734.0 768.0 CE2_12_2012 CE2_12-52 1157.00 ... (3 Replies)
Discussion started by: attila
3 Replies

9. Shell Programming and Scripting

awk to calculate date and show data

data: hostcomment { host_name=myhost01 entry_type=1 comment_id=1 source=0 persistent=1 entry_time=1415723753 expires=0 expire_time=0 author=hpsm comment_data=IM0837437472 } program { modified_host_attributes=1 modified_service_attributes=1 enable_notifications=1... (20 Replies)
Discussion started by: SkySmart
20 Replies

10. Shell Programming and Scripting

How to make awk command faster for large amount of data?

I have nginx web server logs with all requests that were made and I'm filtering them by date and time. Each line has the following structure: 127.0.0.1 - xyz.com GET 123.ts HTTP/1.1 (200) 0.000 s 3182 CoreMedia/1.0.0.15F79 (iPhone; U; CPU OS 11_4 like Mac OS X; pt_br) These text files are... (21 Replies)
Discussion started by: brenoasrm
21 Replies
lldptool(8)							       Linux							       lldptool(8)

NAME
ETS-{CFG|REC} - Show / manipulate ETS TLV configuration SYNOPSIS
lldptool -t -i ethx -V ETS-CFG <-c CONFIG_ARG ...> CONFIG_ARG := { enableTx | willing | tsa | up2tc | numtcs | tcbw } lldptool -T -i ethx -V ETS-CFG CONFIG_ARG=value ... CONFIG_ARG := enableTx = {yes|no} | willing = {yes|no} | tsa = tc:{ets|strict|vendor},... | up2tc = priority:tc,... | tcbw = bw1,bw2,... lldptool -t -i ethx -V ETS-REC <-c CONFIG_ARG ...> lldptool -T -i ethx -V ETS-REC CONFIG_ARG=value ... CONFIG_ARG := enableTx = {yes|no} | tsa = tc:{ets|strict|vendor},... | up2tc = priority:tc,... | tcbw = bw1,bw2,... DESCRIPTION
The Extended Transmission Selection (ETS) feature has a recommendation TLV and a configuration TLV configured with ETS-REC and ETS-CFG respectively. ARGUMENTS
enableTx Enables the ETS TLV to be transmitted willing Sets the ETS-CFG willing bit tsa Transmission selection algorithm, sets a comma separated list of traffic classes to the corresponding selection algorithm. Valid algorithms include "ets", "strict" and "vendor". up2tc Comma separated list mapping user priorities to traffic classes. tcbw Comma separated list of bandwiths for each traffic class the first value being assigned to traffic class 0 and the second to traffic class 1 and so on. Undefined bandwidths are presumed to be 0. numtcs Sets/Displays the number of ETS supported traffic classes. Theory of Operations IEEE 802.1Qaz is enabled by default on hardware that supports this mode indicated by support for the DCBNL interface. Kernel config option CONFIG_DCB. The ETS-CFG TLV is advertised by default with the attributes indicated by querying the hardware for its current configuration. A valid configuration is to map all priorities to a single traffic class and use the link strict selection algorithm. This is equivalent to being in a non-DCB enabled mode. To support legacy CEE DCBX the ETS-CFG and ETS-REC TLVs are disabled if a CEE TLV is received and there are no valid IEEE 802.1Qaz TLVs present. At this time the hardware DCBX mode will be set to CEE and IEEE mode is disabled. This allows switches to be configured and end nodes will then be configured accordingly without any configuration required on the end node. Mapping applications and protocols to traffic classes is required for ETS to be useful. User space programs can encode the priority of an application with the SO_PRIORITY option. Low level drivers that support priority to traffic class mappings may enable this mode by default. For drivers that do not support this mode manual configuration can support this mode of operation see tc-mqprio(8) and tc-multiq. Addi- tionally, tc qdiscs and filters can be used to map protocols to queues see tc(8) for more details along these lines. Finally, many drivers have support for specific protocols ie Fiber Channel over Ethernet (FCoE). EXAMPLE &; USAGE Configure willing bit for interface eth2 lldptool -T -i eth2 -V ETS-CFG willing=yes Configure traffic classes for ETS and strict priority on eth2 lldptool -T -i eth2 -V ETS-CFG tsa=0:ets,1:ets,2:ets,3:ets,4:strict,5:strict Configure 1:1 mapping from priority to traffic classes on eth2 lldptool -T -i eth2 -V ETS-CFG up2tc=0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7 Display local configured ETS-CFG parameters for tcbw lldptool -t -i eth2 -V ETS-CFG -c tcbw Display last transmitted ETS-CFG TLV lldptool -t -i eth2 -V ETS-CFG Configure ETS-CFG and ETS-REC for default DCB on eth2 lldptool -T -i eth2 -V ETS-CFG tsa=0:ets,1:ets,2:ets,3:ets,4:ets,5:ets,6:ets,7:ets up2tc=0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7 tcbw=12,12,12,12,13,13,13,13 lldptool -T -i eth2 -V ETS-REC tsa=0:ets,1:ets,2:ets,3:ets,4:ets,5:ets,6:ets,7:ets up2tc=0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7 tcbw=12,12,12,12,13,13,13,13 SOURCE
o IEEE 802.1Qaz (http://www.ieee802.org/1/pages/dcbridges.html) NOTES
Support for tc-mqprio was added in 2.6.38 on older kernels other mechanisms may need to be used to map applications to traffic classes. SEE ALSO
lldptool(8), lldptool-app(8), lldpad(8), tc-mqprio(8), AUTHOR
John Fastabend open-lldp February 2010 lldptool(8)
All times are GMT -4. The time now is 10:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy