Sponsored Content
Full Discussion: Read from last point
Top Forums Shell Programming and Scripting Read from last point Post 302976658 by Don Cragun on Saturday 2nd of July 2016 03:31:03 PM
Old 07-02-2016
You can save the last timestamp processed by your awk script and reload that value in your shell script before calling awk the next time and then have awk skip over all lines with a timestamp that is less than or equal to the saved timestamp. For example:
Code:
#!/bin/ksh
IAm=${0##*/}
TSF="$HOME/.LastTimeStamp"

if [ ! -f $TSF ]
then	printf '%s: Time stamp file (%s) not found.\n\tProcessing all timestamps.\n' \
	    "$IAm" "$TSF" >&2
	ts=0
else	read ts < "$TSF"
fi
awk -v TS="$ts" -v TSF="$TSF" '
$1 + 0 <= TS {
	# Skip previous processed timestamps.
	next
}
{	# Do what every you want to do with the new timestamp...
	# Save last completed time stamp.
	print $1 > TSF
	close(TSF)
}' input_file...

Obviously, you should also verify that the read was successful, but this might work as a starting point for what you need.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Fibre connection Point to Point SUN

Anyone know of a guide or instructions for Solaris I got to configure a SBUS HBA to talk to a tape robot. I have done this on a switch but not point to point. just going HBA >>>>> TAPE Fibre simple two nodes Kie (6 Replies)
Discussion started by: kie
6 Replies

2. UNIX for Advanced & Expert Users

read() wont allow me to read files larger than 2 gig (on a 64bit)

Hi the following c-code utilizing the 'read()' man 2 read method cant read in files larger that 2gig. Hi I've found a strange problem on ubuntu64bit, that limits the data you are allowed to allocate on a 64bit platform using the c function 'read()' The following program wont allow to allocate... (14 Replies)
Discussion started by: monkeyking
14 Replies

3. Shell Programming and Scripting

Read Embedded Newline characters with read (builtin) in KSH93

Hi Guys, Happy New Year to you all! I have a requirement to read an embedded new-line using KSH's read builtin. Here is what I am trying to do: run_sql "select guestid, address, email from guest" | while read id addr email do ## Biz logic goes here done I can take care of any... (6 Replies)
Discussion started by: a_programmer
6 Replies

4. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

5. Shell Programming and Scripting

Help with Bash piped while-read and a read user input at the same time

Hi I am new to writing script and want to use a Bash Piped while-read and read from user input. if something happens on server.log then do while loop or if something happend on user input then do while loop. Pseudocode something like: tail -n 3 -f server.log | while read serverline || read... (8 Replies)
Discussion started by: MyMorris
8 Replies

6. Shell Programming and Scripting

How to perform a hexdump using dd from start point to end point?

hi, I would like to ask or is it possible to dump a hex using dd from starting point to end point just like the "xxd -s 512 -l 512 <bin file>" I know the redirect hexdump -C but i can't figure it out the combination options of dd. Hope someone can share their knowledge.. Thanks in... (3 Replies)
Discussion started by: jao_madn
3 Replies

7. Linux

Make directory used as mount point read-only

For my backup , I mount and external hard disk to /mnt/mybackup and then I do an rsync to /mnt/mybackup If for some reason the rsync fails, I want to prevent it from writing data on the server hard disk itself since the external hard disk will no longer be mounted on it. I want /mnt/mybackup... (8 Replies)
Discussion started by: coolatt
8 Replies

8. Shell Programming and Scripting

[Bash] Read History function & Read Arrowkeys

Hi. How can I create a history function? (By "read" command or so) & How can I configure a read command so that the arrow keys are not displayed so funny? (^[[A) Thanks in advance. (4 Replies)
Discussion started by: sinnlosername
4 Replies

9. Shell Programming and Scripting

Read from last point

Hi again, first thanks for all your suggestions. This forum it is very useful. I have a question. Is it possible to read from the last line a file was closed. For example, imagine that i've got a file with a LOT of timestamps : 1467387616.868717770 1467387616.874189609... (1 Reply)
Discussion started by: Board27
1 Replies

10. UNIX for Beginners Questions & Answers

How to create a new mount point with 600GB and add 350 GBexisting mount point? IN AIX

How to create a new mount point with 600GB and add 350 GBexisting mount point Best if there step that i can follow or execute before i mount or add diskspace IN AIX Thanks (2 Replies)
Discussion started by: Thilagarajan
2 Replies
STRUCT 
IEEE80211_OPS(9) The basic mac80211 driver inte STRUCT IEEE80211_OPS(9) NAME
struct_ieee80211_ops - callbacks from mac80211 to the driver SYNOPSIS
struct ieee80211_ops { int (* tx) (struct ieee80211_hw *hw, struct sk_buff *skb); int (* start) (struct ieee80211_hw *hw); void (* stop) (struct ieee80211_hw *hw); int (* add_interface) (struct ieee80211_hw *hw,struct ieee80211_vif *vif); void (* remove_interface) (struct ieee80211_hw *hw,struct ieee80211_vif *vif); int (* config) (struct ieee80211_hw *hw, u32 changed); void (* bss_info_changed) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_bss_conf *info,u32 changed); u64 (* prepare_multicast) (struct ieee80211_hw *hw,int mc_count, struct dev_addr_list *mc_list); void (* configure_filter) (struct ieee80211_hw *hw,unsigned int changed_flags,unsigned int *total_flags,u64 multicast); int (* set_tim) (struct ieee80211_hw *hw, struct ieee80211_sta *sta,bool set); int (* set_key) (struct ieee80211_hw *hw, enum set_key_cmd cmd,struct ieee80211_vif *vif, struct ieee80211_sta *sta,struct ieee80211_key_conf *key); void (* update_tkip_key) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_key_conf *conf,struct ieee80211_sta *sta,u32 iv32, u16 *phase1key); int (* hw_scan) (struct ieee80211_hw *hw,struct cfg80211_scan_request *req); void (* sw_scan_start) (struct ieee80211_hw *hw); void (* sw_scan_complete) (struct ieee80211_hw *hw); int (* get_stats) (struct ieee80211_hw *hw,struct ieee80211_low_level_stats *stats); void (* get_tkip_seq) (struct ieee80211_hw *hw, u8 hw_key_idx,u32 *iv32, u16 *iv16); int (* set_rts_threshold) (struct ieee80211_hw *hw, u32 value); int (* sta_add) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta *sta); int (* sta_remove) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta *sta); void (* sta_notify) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,enum sta_notify_cmd, struct ieee80211_sta *sta); int (* conf_tx) (struct ieee80211_hw *hw, u16 queue,const struct ieee80211_tx_queue_params *params); u64 (* get_tsf) (struct ieee80211_hw *hw); void (* set_tsf) (struct ieee80211_hw *hw, u64 tsf); void (* reset_tsf) (struct ieee80211_hw *hw); int (* tx_last_beacon) (struct ieee80211_hw *hw); int (* ampdu_action) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum ieee80211_ampdu_mlme_action action,struct ieee80211_sta *sta, u16 tid, u16 *ssn); void (* rfkill_poll) (struct ieee80211_hw *hw); void (* set_coverage_class) (struct ieee80211_hw *hw, u8 coverage_class); #ifdef CONFIG_NL80211_TESTMODE int (* testmode_cmd) (struct ieee80211_hw *hw, void *data, int len); #endif void (* flush) (struct ieee80211_hw *hw, bool drop); }; MEMBERS
tx Handler that 802.11 module calls for each transmitted frame. skb contains the buffer starting from the IEEE 802.11 header. The low-level driver should send the frame out based on configuration in the TX control data. This handler should, preferably, never fail and stop queues appropriately, more importantly, however, it must never fail for A-MPDU-queues. This function should return NETDEV_TX_OK except in very limited cases. Must be implemented and atomic. start Called before the first netdevice attached to the hardware is enabled. This should turn on the hardware and must turn on frame reception (for possibly enabled monitor interfaces.) Returns negative error codes, these may be seen in userspace, or zero. When the device is started it should not have a MAC address to avoid acknowledging frames before a non-monitor device is added. Must be implemented and can sleep. stop Called after last netdevice attached to the hardware is disabled. This should turn off the hardware (at least it must turn off frame reception.) May be called right after add_interface if that rejects an interface. If you added any work onto the mac80211 workqueue you should ensure to cancel it on this callback. Must be implemented and can sleep. add_interface Called when a netdevice attached to the hardware is enabled. Because it is not called for monitor mode devices, start and stop must be implemented. The driver should perform any initialization it needs before the device can be enabled. The initial configuration for the interface is given in the conf parameter. The callback may refuse to add an interface by returning a negative error code (which will be seen in userspace.) Must be implemented and can sleep. remove_interface Notifies a driver that an interface is going down. The stop callback is called after this if it is the last interface and no monitor interfaces are present. When all interfaces are removed, the MAC address in the hardware must be cleared so the device no longer acknowledges packets, the mac_addr member of the conf structure is, however, set to the MAC address of the device going away. Hence, this callback must be implemented. It can sleep. config Handler for configuration requests. IEEE 802.11 code calls this function to change hardware configuration, e.g., channel. This function should never fail but returns a negative error code if it does. The callback can sleep. bss_info_changed Handler for configuration requests related to BSS parameters that may vary during BSS's lifespan, and may affect low level driver (e.g. assoc/disassoc status, erp parameters). This function should not be used if no BSS has been set, unless for association indication. The changed parameter indicates which of the bss parameters has changed when a call is made. The callback can sleep. prepare_multicast Prepare for multicast filter configuration. This callback is optional, and its return value is passed to configure_filter. This callback must be atomic. configure_filter Configure the device's RX filter. See the section "Frame filtering" for more information. This callback must be implemented and can sleep. set_tim Set TIM bit. mac80211 calls this function when a TIM bit must be set or cleared for a given STA. Must be atomic. set_key See the section "Hardware crypto acceleration" This callback is only called between add_interface and remove_interface calls, i.e. while the given virtual interface is enabled. Returns a negative error code if the key can't be added. The callback can sleep. update_tkip_key See the section "Hardware crypto acceleration" This callback will be called in the context of Rx. Called for drivers which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. The callback must be atomic. hw_scan Ask the hardware to service the scan request, no need to start the scan state machine in stack. The scan must honour the channel configuration done by the regulatory agent in the wiphy's registered bands. The hardware (or the driver) needs to make sure that power save is disabled. The req ie/ie_len members are rewritten by mac80211 to contain the entire IEs after the SSID, so that drivers need not look at these at all but just send them after the SSID -- mac80211 includes the (extended) supported rates and HT information (where applicable). When the scan finishes, ieee80211_scan_completed must be called; note that it also must be called when the scan cannot finish due to any error unless this callback returned a negative error code. The callback can sleep. sw_scan_start Notifier function that is called just before a software scan is started. Can be NULL, if the driver doesn't need this notification. The callback can sleep. sw_scan_complete Notifier function that is called just after a software scan finished. Can be NULL, if the driver doesn't need this notification. The callback can sleep. get_stats Return low-level statistics. Returns zero if statistics are available. The callback can sleep. get_tkip_seq If your device implements TKIP encryption in hardware this callback should be provided to read the TKIP transmit IVs (both IV32 and IV16) for the given key from hardware. The callback must be atomic. set_rts_threshold Configuration of RTS threshold (if device needs it) The callback can sleep. sta_add Notifies low level driver about addition of an associated station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. sta_remove Notifies low level driver about removal of an associated station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. sta_notify Notifies low level driver about power state transition of an associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic. conf_tx Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), bursting) for a hardware TX queue. Returns a negative error code on failure. The callback can sleep. get_tsf Get the current TSF timer value from firmware/hardware. Currently, this is only used for IBSS mode BSSID merging and debugging. Is not a required function. The callback can sleep. set_tsf Set the TSF timer to the specified value in the firmware/hardware. Currently, this is only used for IBSS mode debugging. Is not a required function. The callback can sleep. reset_tsf Reset the TSF timer and allow firmware/hardware to synchronize with other STAs in the IBSS. This is only used in IBSS mode. This function is optional if the firmware/hardware takes full care of TSF synchronization. The callback can sleep. tx_last_beacon Determine whether the last IBSS beacon was sent by us. This is needed only for IBSS mode and the result of this function is used to determine whether to reply to Probe Requests. Returns non-zero if this device sent the last beacon. The callback can sleep. ampdu_action Perform a certain A-MPDU action The RA/TID combination determines the destination and TID we want the ampdu action to be performed for. The action is defined through ieee80211_ampdu_mlme_action. Starting sequence number (ssn) is the first frame we expect to perform the action on. Notice that TX/RX_STOP can pass NULL for this parameter. Returns a negative error code on failure. The callback must be atomic. rfkill_poll Poll rfkill hardware state. If you need this, you also need to set wiphy->rfkill_poll to true before registration, and need to call wiphy_rfkill_set_hw_state in the callback. The callback can sleep. set_coverage_class Set slot time for given coverage class as specified in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout accordingly. This callback is not required and may sleep. testmode_cmd Implement a cfg80211 test mode command. The callback can sleep. flush Flush all pending frames from the hardware queue, making sure that the hardware queues are empty. If the parameter drop is set to true, pending frames may be dropped. The callback can sleep. DESCRIPTION
This structure contains various callbacks that the driver may handle or, in some cases, must handle, for example to configure the hardware to a new channel or to transmit a frame. AUTHOR
Johannes Berg <johannes@sipsolutions.net> Author. COPYRIGHT
Kernel Hackers Manual 2.6. July 2010 STRUCT IEEE80211_OPS(9)
All times are GMT -4. The time now is 05:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy