11-26-2008
Thanks for your effort now it works.
# awk 'END {
> if (t)
> print e, "Total:", t
> }
if (t)
> /\.exe/ {
> if (t)
> print e, "Total:", t
> t = 0
> e = $0 }
/Total/ { t += $NF }
' nisse_081121_11.log
> }
> /Total/ { t += $NF }
> ' nisse_081121_11.log
081125_08:38 14315 2.39 798928 198257 SOM.exe Total: 56098
081125_09:38 14315 2.32 798928 198257 SOM.exe Total: 57220
#
If I want to search for another word, would it just do to change Total?
/Total/ { t += $NF }
And if it is not that clean as it is now with the numbers. If it was text after it. I.e
Total houses = 32245 houses
Would it still work?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
sys::statistics::linux::memstats
Sys::Statistics::Linux::MemStats(3pm) User Contributed Perl Documentation Sys::Statistics::Linux::MemStats(3pm)
NAME
Sys::Statistics::Linux::MemStats - Collect linux memory information.
SYNOPSIS
use Sys::Statistics::Linux::MemStats;
my $lxs = Sys::Statistics::Linux::MemStats->new;
my $stat = $lxs->get;
DESCRIPTION
Sys::Statistics::Linux::MemStats gathers memory statistics from the virtual /proc filesystem (procfs).
For more information read the documentation of the front-end module Sys::Statistics::Linux.
MEMORY INFORMATIONS
Generated by /proc/meminfo.
memused - Total size of used memory in kilobytes.
memfree - Total size of free memory in kilobytes.
memusedper - Total size of used memory in percent.
memtotal - Total size of memory in kilobytes.
buffers - Total size of buffers used from memory in kilobytes.
cached - Total size of cached memory in kilobytes.
realfree - Total size of memory is real free (memfree + buffers + cached).
realfreeper - Total size of memory is real free in percent of total memory.
swapused - Total size of swap space is used is kilobytes.
swapfree - Total size of swap space is free in kilobytes.
swapusedper - Total size of swap space is used in percent.
swaptotal - Total size of swap space in kilobytes.
swapcached - Memory that once was swapped out, is swapped back in but still also is in the swapfile.
active - Memory that has been used more recently and usually not reclaimed unless absolutely necessary.
inactive - Memory which has been less recently used and is more eligible to be reclaimed for other purposes.
On earlier kernels (2.4) Inact_dirty + Inact_laundry + Inact_clean.
The following statistics are only available by kernels from 2.6.
slab - Total size of memory in kilobytes that used by kernel for data structure allocations.
dirty - Total size of memory pages in kilobytes that waits to be written back to disk.
mapped - Total size of memory in kilbytes that is mapped by devices or libraries with mmap.
writeback - Total size of memory that was written back to disk.
committed_as - The amount of memory presently allocated on the system.
The following statistic is only available by kernels from 2.6.9.
commitlimit - Total amount of memory currently available to be allocated on the system.
METHODS
new()
Call "new()" to create a new object.
my $lxs = Sys::Statistics::Linux::MemStats->new;
It's possible to set the path to the proc filesystem.
Sys::Statistics::Linux::MemStats->new(
files => {
# This is the default
path => '/proc',
meminfo => 'meminfo',
}
);
get()
Call "get()" to get the statistics. "get()" returns the statistics as a hash reference.
my $stat = $lxs->get;
EXPORTS
No exports.
SEE ALSO
proc(5)
REPORTING BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
COPYRIGHT
Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-03-09 Sys::Statistics::Linux::MemStats(3pm)