Sponsored Content
Top Forums Shell Programming and Scripting How can I add 4 lines together and then read the next 4 lines? Post 302261689 by mr_andrew on Tuesday 25th of November 2008 10:50:41 AM
Old 11-25-2008
# awk 'END {
> if(t)
> print e, "Total:",t
> }
> /exe$/ {
> if (t)
> print e, "Total:", t
> t = 0
> e = $0
> }
> /Total/ { t +=$NF }
> ' nisse_081121_11.log
#
Nothing happened..


[root@knasen]> cat test
#!/usr/bin/sh
END {
if (t)
print e, "Total:", t
}
/exe$/ {
if (t)
print e, "Total:", t
t = 0
e = $0
}
/Total/ { t += $NF }
[root@knasen]> awk -f test nisse_081121_11.log
[root@knasen]>

No output..

Am I doing it from the wrong shell?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to read lines one by one from a file

I have one file in which some commands have written line line i have to read lines from this file(file name passed as avariable) and then i have to execute these commands.. how can i do it? (5 Replies)
Discussion started by: bihani4u
5 Replies

2. UNIX for Dummies Questions & Answers

Read lines from file

i have a problem on my bourne shell script. I want to read line by line and then stop when the line does not have letters or is an empty string. But i encounter an error at "while ". The error nessage is "test.sh: test: unknown operator line". Can anyone help me on this thanks :) (2 Replies)
Discussion started by: sagolo
2 Replies

3. Shell Programming and Scripting

read some lines from file!!!

any idea please!!! I want to pick up all lines of "state" and "desc" from x files: ... # state blah blah blah blah ... .. # desc blah blah blah .... Thx Andy (7 Replies)
Discussion started by: andy2000
7 Replies

4. UNIX for Dummies Questions & Answers

How to count lines - ignoring blank lines and commented lines

What is the command to count lines in a files, but ignore blank lines and commented lines? I have a file with 4 sections in it, and I want each section to be counted, not including the blank lines and comments... and then totalled at the end. Here is an example of what I would like my... (6 Replies)
Discussion started by: kthatch
6 Replies

5. Shell Programming and Scripting

Help!! Need script to read files and add values by lines...

Hi All, I really need your help. I am a begginner in shell script and I believe this is a very simple issue. I have in my directory, n-files, like 1.dhm, 2.dhm, 3.dhm. These files have 1 column with 1 value per line, like: 1.dhm ------ 10 20 30 40 50 2.dhm ------ 30 50 20 (3 Replies)
Discussion started by: dhuertas
3 Replies

6. Shell Programming and Scripting

How to read different lines into column

Dear experts, Need your great help ! The input file is as follows: Name: test01 Name UID: C7:9D:79:52:2A:3F:DF:11:A8:64:00:60:16:36:04:02 Shareable: YES HBA/SP Pairs: HBA UID SP Name SPPort ------- ... (9 Replies)
Discussion started by: tojzz
9 Replies

7. 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

8. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

9. Shell Programming and Scripting

Extract some lines from one file and add those lines to current file

hi, i have two files. file1.sh echo "unix" echo "linux" file2.sh echo "unix linux forums" now the output i need is $./file2.sh unix linux forums (3 Replies)
Discussion started by: snreddy_gopu
3 Replies

10. Shell Programming and Scripting

Read few last lines of a file

Hi, I have a txt file in below format - START 1 2 3 4 END START 5 6 7 8 END START 9 10 END (8 Replies)
Discussion started by: bhupinder08
8 Replies
pppstats(1M)						  System Administration Commands					      pppstats(1M)

NAME
pppstats - print PPP statistics SYNOPSIS
pppstats [-a] [-v] [-r] [-z] [-c <count>] [-w <secs>] [interface] DESCRIPTION
The pppstats utility reports PPP-related statistics at regular intervals for the specified PPP interface. If the interface is unspecified, pppstats defaults to sppp0. The display is split horizontally into input and output sections containing columns of statistics describing the properties and volume of packets received and transmitted by the interface. OPTIONS
The pppstats options are: -a Display absolute values rather than deltas. With this option, all reports show statistics for the time elapsed since the link was initiated. Without this option, the second and subsequent reports show statistics for the time since the last report. -c count Repeat the display count times. If this option is not specified, the default repeat count is 1 if the -w option is not specified, otherwise infinity. -r Display additional statistics summarizing the compression ratio achieved by the packet compression algorithm in use. -v Display additional statistics relating to the performance of the Van Jacobson TCP header compression algorithm. -w wait Pause wait seconds between each display. If this option is not specified, the default interval is five seconds. -z Instead of the standard display, show statistics indicating the performance of the packet compression algorithm in use. EXTENDED DESCRIPTION
The following fields are printed on the input side when the -z option is not used: IN Total number of bytes received by this interface. PACK Total number of packets received by this interface. VJCOMP Number of header-compressed TCP packets received by this interface. VJUNC Number of header-uncompressed TCP packets received by this interface. Not reported when the -r option is specified. VJERR Number of corrupted or bogus header-compressed TCP packets received by this interface. Not reported when the -r option is specified. VJTOSS Number of VJ header-compressed TCP packets dropped on reception by this interface because of preceding errors. Only reported when the -v option is specified. NON-VJ Total number of non-TCP packets received by this interface. Only reported when the -v option is specified. RATIO Compression ratio achieved for received packets by the packet compression scheme in use, defined as the uncompressed size divided by the compressed size. Only reported when the -r option is specified. UBYTE Total number of bytes received, after decompression of compressed packets. Only reported when the -r option is specified. The following fields are printed on the output side: OUT Total number of bytes transmitted from this interface. PACK Total number of packets transmitted from this interface. VJCOMP Number of TCP packets transmitted from this interface with VJ-compressed TCP headers. VJUNC Number of TCP packets transmitted from this interface with VJ-uncompressed TCP headers. Not reported when the -r option is specified. NON-VJ Total number of non-TCP packets transmitted from this interface. Not reported when the -r option is specified. VJSRCH Number of searches for the cached header entry for a VJ header compressed TCP packet. Only reported when the -v option is specified. VJMISS Number of failed searches for the cached header entry for a VJ header compressed TCP packet. Only reported when the -v option is specified. RATIO Compression ratio achieved for transmitted packets by the packet compression scheme in use, defined as the size before com- pression divided by the compressed size. Only reported when the -r option is specified. UBYTE Total number of bytes to be transmitted before packet compression is applied. Only reported when the -r option is speci- fied. When the -z option is specified, pppstats displays the following fields relating to the packet compression algorithm currently in use. If packet compression is not in use, these fields display zeroes. The fields displayed on the input side are: COMPRESSED BYTE Number of bytes of compressed packets received. COMPRESSED PACK Number of compressed packets received. INCOMPRESSIBLE BYTE Number of bytes of incompressible packets (that is, those which were transmitted in uncompressed form) received. INCOMPRESSIBLE PACK Number of incompressible packets received. COMP RATIO Recent compression ratio for incoming packets, defined as the uncompressed size divided by the compressed size (including both compressible and incompressible packets). The fields displayed on the output side are: COMPRESSED BYTE Number of bytes of compressed packets transmitted. COMPRESSED PACK Number of compressed packets transmitted. INCOMPRESSIBLE BYTE Number of bytes of incompressible packets received; that is, those that were transmitted by the peer in uncom- pressed form. INCOMPRESSIBLE PACK Number of incompressible packets transmitted. COMP RATIO Recent compression ratio for outgoing packets. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpppdu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
pppd(1M), attributes(5) SunOS 5.10 4 May 2001 pppstats(1M)
All times are GMT -4. The time now is 05:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy