Sponsored Content
Top Forums Shell Programming and Scripting Compute value from more than three consecutive rows Post 302971377 by kathy wang on Tuesday 19th of April 2016 02:16:40 PM
Old 04-19-2016
Thank you, Runic and Don Cragun, I had tried the new code as suggested, but there is a problem. If I use the new input as below:010730023 2014-06-30 07:00 78.0 21.8081
Code:
010730023 2014-06-30 08:00 80.0 21.8081
010730023 2014-06-30 09:00 80.0 21.8081
010730023 2014-06-30 10:00 78.0 21.8081
010730023 2014-06-30 11:00 92.0 21.8081
010730023 2014-06-30 12:00 89.0 21.8081
010730023 2014-06-30 13:00 83.0 21.8081
010730023 2014-06-30 14:00 80.0 21.8081
010730023 2014-06-30 15:00 82.0 21.8081
010730023 2014-06-30 16:00 88.0 21.8081
010730023 2014-06-30 17:00 89.0 21.8081
010730023 2014-06-30 18:00 106.0 21.8081

I got output as:
Code:
010730023 2014-06-30 08:00 80.0 21.8081  1

The desired output should be:
Code:
010730023 2014-06-30 08:00 80.0 21.8081 1
010730023 2014-06-30 09:00 80.0 21.8081 1
010730023 2014-06-30 10:00 78.0 21.8081 1
010730023 2014-06-30 11:00 92.0 21.8081 1
010730023 2014-06-30 12:00 89.0 21.8081 1
010730023 2014-06-30 13:00 83.0 21.8081 1
010730023 2014-06-30 14:00 80.0 21.8081 1
010730023 2014-06-30 15:00 82.0 21.8081 1
010730023 2014-06-30 16:00 88.0 21.8081 1
010730023 2014-06-30 17:00 89.0 21.8081 1
010730023 2014-06-30 18:00 106.0 21.8081 1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compute total from a text file

Hi, I've encountered a problem with a perl and ksh script that totals a certain field in a text file. The computed total of the script is 295540304 but the expected is 297959288, a 2 million difference. The KSH script reads from bottom to top, and the discrepancy started on line 47 (1279th MAN... (1 Reply)
Discussion started by: rsf01
1 Replies

2. UNIX for Advanced & Expert Users

CPU Usage at another Compute Node?

Hi, I am trying to get the cpu usage of a job/process. The machine that has these jobs is a cluster with 1 master node and 10 compute nodes. Now, the complexity is that not all jobs are on the master node. So, in order to get the cpu usage of a job at another node, I have to ssh into it and... (0 Replies)
Discussion started by: davidfrank
0 Replies

3. Shell Programming and Scripting

How to capture 2 consecutive rows when a condition is true ?

Hi All, i have an input below. As long as "x= 1" , i would want to capture 2 lines using sed or awk for eg : 0001 x= 1 $---------------------------------..-.--.. 0001 tt= 137 171 423 1682 2826 0 Pls help. Thanks in advance. Note that the number of lines in each block do... (37 Replies)
Discussion started by: Raynon
37 Replies

4. Shell Programming and Scripting

to compute diskspace

Guys, have any idea for the script like this? also to compute w/ decimal. thanks a=10 b=20 c=30 d=40 if a < b then ( a -b)*1024 = free space b + (c -d) = total space if a > b then (b / d)*1024 = cpu (3 Replies)
Discussion started by: kenshinhimura
3 Replies

5. Shell Programming and Scripting

compute compilation time using script

Hi, I use this script to compute compilation time several time to get system performance and compare different system: #!/bin/sh # measure the different between time before and # after the compilation of benchmark # Start at iteration 1 num=1 while do # Add one to the iteration... (3 Replies)
Discussion started by: zainab
3 Replies

6. Web Development

How to compute previous and next buttons?

I have a project to migrate my club's membership database from Access to web based using MySQL/PHP, but I have a problem I can't get my head around and would appreciate some help... Background... I want to be able to display each member's data on screen and add a Previous and Next button to move... (2 Replies)
Discussion started by: JerryHone
2 Replies

7. Shell Programming and Scripting

remove consecutive duplicate rows

I have some data that looks like, 1 3300665.mol 3300665 5177008 102.093 2 3300665.mol 3300665 5177008 102.093 3 3294015.mol 3294015 5131552 102.114 4 3294015.mol 3294015 5131552 102.114 5 3293734.mol 3293734 5129625 104.152 6 3293734.mol ... (13 Replies)
Discussion started by: LMHmedchem
13 Replies

8. Shell Programming and Scripting

Compute Difference and Edit second, third columns

Hi Friends, My input file is like this chr1 100 200 chr1 300 330 chr1 2000 2000 chr1 5000 5000 chr2 7790 7890 chr2 8000 8000 If the difference of third and second columns is zero, then subtract 500 from second column and add 500 to the third column. So, my output would be chr1... (1 Reply)
Discussion started by: jacobs.smith
1 Replies

9. Shell Programming and Scripting

Compute in milisecond by use of mktime

Hi, I want to calculate diff b/w these starttime and endtime with use of mktime. I need response time in milisecond. I am using mktime to get these times. last three digits are in milisecond Starttime 2013-04-03 08:54:19,989 End time 2013-04-03 08:54:39,389 (9 Replies)
Discussion started by: random_thoughts
9 Replies

10. UNIX for Beginners Questions & Answers

Forward Display from compute node

Hello, sorry if this is an easy thing, but I tried to make it run the whole morning, but it doesn't work so far... I am logged in on a visualization node of a high performance cluster. On this node I can run several gui-based software for the postprocessing of my cfd-data. As the... (1 Reply)
Discussion started by: Shlaeae
1 Replies
SHOREWALL-BLACKLIST(5)						  [FIXME: manual]					    SHOREWALL-BLACKLIST(5)

NAME
blacklist - Shorewall Blacklist file SYNOPSIS
/etc/shorewall/blacklist DESCRIPTION
The blacklist file is used to perform static blacklisting. You can blacklist by source address (IP or MAC), or by application. The columns in the file are as follows (where the column name is followed by a different name in parentheses, the different name is used in the alternate specification syntax). ADDRESS/SUBNET (networks) - {-|~mac-address|ip-address|address-range|+ipset} Host address, network address, MAC address, IP address range (if your kernel and iptables contain iprange match support) or ipset name prefaced by "+" (if your kernel supports ipset match). Exclusion (shorewall-exclusion[1](5)) is supported. MAC addresses must be prefixed with "~" and use "-" as a separator. Example: ~00-A0-C9-15-39-78 A dash ("-") in this column means that any source address will match. This is useful if you want to blacklist a particular application using entries in the PROTOCOL and PORTS columns. PROTOCOL (proto) - {-|[!]protocol-number|[!]protocol-name} Optional - If specified, must be a protocol number or a protocol name from protocols(5). PORTS - {-|[!]port-name-or-number[,port-name-or-number]...} Optional - may only be specified if the protocol is TCP (6) or UDP (17). A comma-separated list of destination port numbers or service names from services(5). OPTIONS - {-|{dst|src|whitelist|audit}[,...]} Optional - added in 4.4.12. If specified, indicates whether traffic from ADDRESS/SUBNET (src) or traffic to ADDRESS/SUBNET (dst) should be blacklisted. The default is src. If the ADDRESS/SUBNET column is empty, then this column has no effect on the generated rule. Note In Shorewall 4.4.12, the keywords from and to were used in place of src and dst respectively. Blacklisting was still restricted to traffic arriving on an interface that has the 'blacklist' option set. So to block traffic from your local network to an internet host, you had to specify blacklist on your internal interface in shorewall-interfaces[2] (5). Note Beginning with Shorewall 4.4.13, entries are applied based on the blacklist setting in shorewall-zones[3](5): 1. 'blacklist' in the OPTIONS or IN_OPTIONS column. Traffic from this zone is passed against the entries in this file that have the src option (specified or defaulted). 2. 'blacklist' in the OPTIONS or OUT_OPTIONS column. Traffic to this zone is passed against the entries in this file that have the dst option. In Shorewall 4.4.20, the whitelist option was added. When whitelist is specified, packets/connections that match the entry are not matched against the remaining entries in the file. The audit option was also added in 4.4.20 and causes packets matching the entry to be audited. The audit option may not be specified in whitelist entries and require AUDIT_TARGET support in the kernel and iptables. EXAMPLE
Example 1: To block DNS queries from address 192.0.2.126: #ADDRESS/SUBNET PROTOCOL PORT 192.0.2.126 udp 53 Example 2: To block some of the nuisance applications: #ADDRESS/SUBNET PROTOCOL PORT - udp 1024:1033,1434 - tcp 57,1433,1434,2401,2745,3127,3306,3410,4899,5554,6101,8081,9898 FILES
/etc/shorewall/blacklist SEE ALSO
http://shorewall.net/blacklisting_support.htm http://shorewall.net/configuration_file_basics.htm#Pairs shorewall(8), shorewall-accounting(5), shorewall-actions(5), shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5), shorewall-params(5), shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5) NOTES
1. shorewall-exclusion http://www.shorewall.net/manpages/shorewall-exclusion.html 2. shorewall-interfaces http://www.shorewall.net/manpages/shorewall-interfaces.html 3. shorewall-zones http://www.shorewall.net/manpages/shorewall-zones.html [FIXME: source] 06/28/2012 SHOREWALL-BLACKLIST(5)
All times are GMT -4. The time now is 08:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy