08-04-2008
Quote:
Originally Posted by
broli
so, if i read your post correctly, with awk i can simulate sime functions of tail or head...
what about sort?
Modern versions of awk have a sort command. I'm not sure if it was included even in the original awk.
Quote:
well. i see now, that perl is a best solution than bash. after all perl was made to process text right? :P
and perl has always been in my todo-list
the problem there would be to pipe the info to dzen
because the way dzen works, i need an never ending loop, so dzen dosnt die
is posible to do that piping from a perl script?
Certainly, but I'm not really suggesting you move to Perl just for this. There are really two schools of thought on this; skip awk, and only learn Perl; or move to Perl if you run into situations which awk cannot handle comfortably. If you need to process binary data or very large data sets, Perl was designed to overcome the limitations awk have in those areas.
But the requirements you have shown so far should be easy to handle in awk; it's just not clear from reading the code in which direction you want the script to grow, and/or I was too lazy to rewrite it all.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
I have a pair of sun ultra 5_10 with SunOS 5.5.1.
Both are almost equally patched and set up with simillar applications.
host# uname -a
SunOS host 5.5.1 Generic_103640-24 sun4u sparc SUNW,Ultra-5_10
Even though both have
same amount of RAM ( 512 Mb ) ,
... (1 Reply)
Discussion started by: shibz
1 Replies
2. Linux
Hi All,
Kindly help me in optimizing the server as it displays a great amount of CPU & MEM being utilised when the mysql process executes.
Below are the stats ---
--------------------------------------------------------------------------
# top
15:51:57 up 23:22, 5 users, load average:... (1 Reply)
Discussion started by: gautamatul82
1 Replies
3. Linux
What is amount of free RAM i have now?
total used free shared buffers cached
Mem: 1010 963 46 0 215 256
-/+ buffers/cache: 491 518
Swap: 1983 0 1983
Above is the output of... (1 Reply)
Discussion started by: new2ss
1 Replies
4. HP-UX
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies
5. AIX
How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies
6. Shell Programming and Scripting
I'm writing a bash script to log some selections from a sensors output (core temp, mb temp, etc.) and I would also like to have the current cpu usage as a percentage. I have no idea how to go about getting it in a form that a bash script can use. For example, I would simply look in the output of... (3 Replies)
Discussion started by: graysky
3 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
Is it possible to get total memory usage and free memory usage without top? By Googling I found for total memory usage, use vmstat, for CPU, use mpstat, for disk I/O use iostat, is this correct? Will using sar gives the same result as ALL of these three (3) commands?
What about if I... (2 Replies)
Discussion started by: newbie_01
2 Replies
8. Shell Programming and Scripting
Hi folks,
I'm a CS students enrolled in a sysadmin class where we've been covering bash scripting for the past few weeks. I have prior knowledge in java, c++, c#, python,and some scripting languages like asp.net w/c# and php. This bash stuff seems pretty neat and a bit different than what I am... (9 Replies)
Discussion started by: KalEl
9 Replies
9. Shell Programming and Scripting
Hi All,
I need to know the command for knowing the total cpu and mem.
Thanks (5 Replies)
Discussion started by: aish11
5 Replies
10. UNIX for Dummies Questions & Answers
I do not know shell scripting. But at work place, I have got an in and out shell scripting task. I just need to understand a very big script. Is there any tool in which I can place the script and it can tell me the meaning of the whole script? (3 Replies)
Discussion started by: lg123
3 Replies
LEARN ABOUT X11R4
libbash
LIBBASH(7) libbash Manual LIBBASH(7)
NAME
libbash -- A bash shared libraries package.
DESCRIPTION
libbash is a package that enables bash dynamic-like shared libraries. Actually its a tool for managing bash scripts whose functions you may
want to load and use in scripts of your own.
It contains a 'dynamic loader' for the shared libraries ( ldbash(1)), a configuration tool (ldbashconfig(8)), and some libraries.
Using ldbash(1) you are able to load loadable bash libraries, such as getopts(1) and hashstash(1). A bash shared library that can be loaded
using
ldbash(1) must answer 4 requirments:
1. It must be installed in $LIBBASH_PREFIX/lib/bash (default is /usr/lib/bash).
2. It must contain a line that begins with '#EXPORT='. That line will contain (after the '=') a list of functions that the library
exports. I.e. all the function that will be usable after loading that library will be listed in that line.
3. It must contain a line that begins with '#REQUIRE='. That line will contain (after the '=') a list of bash libraries that are
required for our library. I.e. every bash library that is in use in our bash library must be listed there.
4. The library must be listed (For more information, see ldbashconfig(8)).
Basic guidelines for writing library of your own:
1. Be aware, that your library will be actually sourced. So, basically, it should contain (i.e define) only functions.
2. Try to declare all variables intended for internal use as local.
3. Global variables and functions that are intended for internal use (i.e are not defined in '#EXPORT=') should begin with:
__<library_name>_
For example, internal function myfoosort of hashstash library should be named as
__hashstash_myfoosort
This helps to avoid conflicts in global name space when using libraries that come from different vendors.
4. See html manual for full version of this guide.
AUTHORS
Hai Zaar <haizaar@haizaar.com>
Gil Ran <ril@ran4.net>
SEE ALSO
ldbash(1), ldbashconfig(8), getopts(1), hashstash(1) colors(1) messages(1) urlcoding(1) locks(1)
Linux Epoch Linux