Sponsored Content
Full Discussion: Divide the numbers in file
Top Forums Shell Programming and Scripting Divide the numbers in file Post 302995897 by gnulyn on Friday 14th of April 2017 11:33:09 AM
Old 04-14-2017
Divide the numbers in file

Dear ALL,

I have sample file :
Code:
tx_bytes: 2422,
tx_packets: 13,
uptime: 16119,

tx_bytes: 2342,
tx_packets: 14,
uptime: 11009,

tx_bytes: 252,
tx_packets: 12,
uptime: 3113,

my formula :
Code:
minutes=$(( uptime/60%60 ))
hours=$(( uptime/60/60%24 ))

required output:
Code:
tx_bytes: 2422,
tx_packets: 13,
uptime: 4:28,

tx_bytes: 2342,
tx_packets: 14,
uptime: 3:3,

tx_bytes: 252,
tx_packets: 12,
uptime: 0:51,

Can you help me pls..

Last edited by vgersh99; 04-14-2017 at 12:56 PM.. Reason: code tags, please
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

divide a single file with different Weboffercodes into different files with each of o

Here is the format of my file; I do not have the delimiter in the file for the data to be separated. Each line in the file is in the following format. File contains the data of different WebOfferCodes Item Code | Account Number | Card Number | Source code | WebOfferCode 12digits | 10... (4 Replies)
Discussion started by: enigma_83
4 Replies

2. Shell Programming and Scripting

read numbers from file and output which numbers belongs to which range

Howdy experts, We have some ranges of number which belongs to particual group as below. GroupNo StartRange EndRange Group0125 935300 935399 Group2006 935400 935476 937430 937459 Group0324 935477 935549 ... (6 Replies)
Discussion started by: thepurple
6 Replies

3. Shell Programming and Scripting

Divide the file into several Variable

I have a file, let's say X BTS 0 UNLOCKED ENABLED NONE TRX 0 UNLOCKED ENABLED NONE TRX 1 UNLOCKED ENABLED NONE BTS 1 UNLOCKED ENABLED NONE TRX 0 UNLOCKED ENABLED NONE... (4 Replies)
Discussion started by: amaulana
4 Replies

4. Shell Programming and Scripting

Divide numbers into intervals

divide input values into specified number (-100 or -200) according to the key (a1 or a2 ....) For ex: if we give -100 in the command line it would create 100 number intervals (1-100, 100-200, 200-300) untill it covers the value 300 in a1. Note: It should work the same even with huge numbers... (3 Replies)
Discussion started by: ruby_sgp
3 Replies

5. Shell Programming and Scripting

the smallest number from 90% of highest numbers from all numbers in file

Hello All, I am having problem to find what is the smallest number from 90% of highest numbers from all numbers in file. I am having file with thousands of lines and hundreds of columns. I am familiar mainly with bash but I am open to whatever suggestion witch will lead to the solutions. If I... (11 Replies)
Discussion started by: Apfik
11 Replies

6. Shell Programming and Scripting

Add and divide each numbers with the added number

Hi All, I am stuck with this problem. I have some 100000 (.dat) 1.dat, 2.dat,3.dat etc until 100000.dat files which look like this: 1.dat 1 2 3 4 0.99 4.54 All my files 1.dat until 100000.dat look the same but with different numbers. I have to first add all the numbers in each... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. UNIX for Dummies Questions & Answers

divide the file into multiple files based on the city name

Hi, I have a file abc.dat. It contains the fileds of empid, empname, empcity. each city contains 10 records. i want to create the city file and pass the same city records into the file. I don't know the city names. In unix using awk command how can we do? abc.dat: 1 john delhi 2... (2 Replies)
Discussion started by: raghukreddy.ab
2 Replies

8. Shell Programming and Scripting

Adding (as in arithmetic) to numbers in columns in file, and writing new file with new numbers

Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do. I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies

9. UNIX for Dummies Questions & Answers

To divide file

We have large log files, and we need to extract last four hours lines only, Please let us know the command. Thanks, Saurau. (1 Reply)
Discussion started by: saurau
1 Replies

10. Shell Programming and Scripting

Script to divide/expand first digit to show some numbers

Hello to everyone, I have this complex problem and I don't how to do it. I'm not sure if awk could be a good choice to do it or could be easiest in bash or perl. A kind of introduction would be: - I have a digit, lets say 3. - I can expand/spread out the digit 3 to cover all possible... (7 Replies)
Discussion started by: Ophiuchus
7 Replies
STRUCT 
STA_INFO(9) Internals STRUCT STA_INFO(9) NAME
struct_sta_info - STA information SYNOPSIS
struct sta_info { struct list_head list; struct rcu_head rcu_head; struct sta_info __rcu * hnext; struct ieee80211_local * local; struct ieee80211_sub_if_data * sdata; struct ieee80211_key __rcu * gtk[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; struct ieee80211_key __rcu * ptk; struct rate_control_ref * rate_ctrl; void * rate_ctrl_priv; spinlock_t lock; struct work_struct drv_unblock_wk; u16 listen_interval; bool dead; bool uploaded; enum ieee80211_sta_state sta_state; unsigned long _flags; struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS]; struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS]; unsigned long driver_buffered_tids; unsigned long rx_packets; u64 rx_bytes; unsigned long wep_weak_iv_count; unsigned long last_rx; long last_connected; unsigned long num_duplicates; unsigned long rx_fragments; unsigned long rx_dropped; int last_signal; struct ewma avg_signal; int last_ack_signal; __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; unsigned long tx_filtered_count; unsigned long tx_retry_failed; unsigned long tx_retry_count; unsigned int fail_avg; u32 tx_fragments; u64 tx_packets[IEEE80211_NUM_ACS]; u64 tx_bytes[IEEE80211_NUM_ACS]; struct ieee80211_tx_rate last_tx_rate; int last_rx_rate_idx; u32 last_rx_rate_flag; u8 last_rx_rate_vht_nss; u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; struct sta_ampdu_mlme ampdu_mlme; u8 timer_to_tid[IEEE80211_NUM_TIDS]; #ifdef CONFIG_MAC80211_MESH __le16 llid; __le16 plid; __le16 reason; u8 plink_retries; bool ignore_plink_timer; enum nl80211_plink_state plink_state; u32 plink_timeout; struct timer_list plink_timer; s64 t_offset; s64 t_offset_setpoint; enum nl80211_mesh_power_mode local_pm; enum nl80211_mesh_power_mode peer_pm; enum nl80211_mesh_power_mode nonpeer_pm; #endif #ifdef CONFIG_MAC80211_DEBUGFS struct sta_info_debugfsdentries debugfs; #endif enum ieee80211_sta_rx_bandwidth cur_max_bandwidth; unsigned int lost_packets; unsigned int beacon_loss_count; struct ieee80211_sta sta; }; MEMBERS
list global linked list entry rcu_head RCU head used for freeing this station struct hnext hash table linked list pointer local pointer to the global information sdata virtual interface this station belongs to gtk[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS] group keys negotiated with this station, if any ptk peer key negotiated with this station, if any rate_ctrl rate control algorithm reference rate_ctrl_priv rate control private per-STA pointer lock used for locking all fields that require locking, see comments in the header file. drv_unblock_wk used for driver PS unblocking listen_interval listen interval of this station, when we're acting as AP dead set to true when sta is unlinked uploaded set to true when sta is uploaded to the driver sta_state duplicates information about station state (for debug) _flags STA flags, see enum ieee80211_sta_info_flags, do not use directly ps_tx_buf[IEEE80211_NUM_ACS] buffers (per AC) of frames to transmit to this station when it leaves power saving state or polls tx_filtered[IEEE80211_NUM_ACS] buffers (per AC) of frames we already tried to transmit but were filtered by hardware due to STA having entered power saving state, these are also delivered to the station when it leaves powersave or polls for frames driver_buffered_tids bitmap of TIDs the driver has data buffered on rx_packets Number of MSDUs received from this STA rx_bytes Number of bytes received from this STA wep_weak_iv_count number of weak WEP IVs received from this station last_rx time (in jiffies) when last frame was received from this STA last_connected time (in seconds) when a station got connected num_duplicates number of duplicate frames received from this STA rx_fragments number of received MPDUs rx_dropped number of dropped MPDUs from this STA last_signal signal of last received frame from this STA avg_signal moving average of signal of received frames from this STA last_ack_signal signal of last received Ack frame from this STA last_seq_ctrl[IEEE80211_NUM_TIDS + 1] last received seq/frag number from this STA (per RX queue) tx_filtered_count number of frames the hardware filtered for this STA tx_retry_failed number of frames that failed retry tx_retry_count total number of retries for frames to this STA fail_avg moving percentage of failed MSDUs tx_fragments number of transmitted MPDUs tx_packets[IEEE80211_NUM_ACS] number of RX/TX MSDUs tx_bytes[IEEE80211_NUM_ACS] number of bytes transmitted to this STA last_tx_rate rate used for last transmit, to report to userspace as "the" transmit rate last_rx_rate_idx rx status rate index of the last data packet last_rx_rate_flag rx status flag of the last data packet last_rx_rate_vht_nss rx status nss of last data packet tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1] per-TID sequence numbers for sending to this STA ampdu_mlme A-MPDU state machine state timer_to_tid[IEEE80211_NUM_TIDS] identity mapping to ID timers llid Local link ID plid Peer link ID reason Cancel reason on PLINK_HOLDING state plink_retries Retries in establishment ignore_plink_timer ignore the peer-link timer (used internally) plink_state peer link state plink_timeout timeout of peer link plink_timer peer link watch timer t_offset timing offset relative to this host t_offset_setpoint reference timing offset of this sta to be used when calculating clockdrift local_pm local link-specific power save mode peer_pm peer-specific power save mode towards local STA nonpeer_pm STA power save mode towards non-peer neighbors debugfs debug filesystem info cur_max_bandwidth maximum bandwidth to use for TX to the station, taken from HT/VHT capabilities or VHT operating mode notification lost_packets number of consecutive lost packets beacon_loss_count number of times beacon loss has triggered sta station information we share with the driver DESCRIPTION
This structure collects information about a station that mac80211 is communicating with. AUTHOR
Johannes Berg <johannes@sipsolutions.net> Author. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 STRUCT STA_INFO(9)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy