10-31-2009
awk & CPU Load
Deal All,
I'm writing a simple awk to generate some sort of report. The awk will check 24 files (file generated each one hour in a wholoe day) and then it will print one field to another file for counting purposes.
The script is working fine but the problem is that the CPU load is very high and almost reaching 100% when the script is running.
Is there a way to improve the CPU Load?
The machine I'm using is Sparc SUNW,Sun-Fire-V240 and the awk command I'm suing is:
cat $year$month$day*.TLG | awk 'BEGIN {FS=","} {if (($1)=="203" || ($1)=="204" || ($1)=="205" || ($1)=="206") print $3}' >> file.txt
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
If unix says my cpu load is 2.15 exactly what does that mean?
--Jason (1 Reply)
Discussion started by: Mac J
1 Replies
2. AIX
after a long period of running, the network application's CPU load in our syst em increase slowly, the failed at the end. we use "truss" tool to trace the process, found that it processes something like "semop" ,"semctl","thread_waitlock","kread" kernel call . The trace log file looks like the... (0 Replies)
Discussion started by: Frank2004
0 Replies
3. Red Hat
Hi Buddies,
Thanx for reading my first post...
After googling a lot and searching so many forums I am feeling down a bit...
Please don't mind my ignorence, and my grammer ... :)
My server is running RHEL 2.6.9-5.EL. The cpu load is going higher than roof, almost 100 sometimes.
I am... (2 Replies)
Discussion started by: squid04
2 Replies
4. Linux
Hi ALL,
I have to develop a script which checks for the load on CPU on regular intervals. I created a simple script which uses 'uptime' command to find out the avg load in the last 5 min. I then used grep and put the value of the avg load in a variable OUT.
It was working fine till... (5 Replies)
Discussion started by: vikings.svnit
5 Replies
5. Solaris
Friends
I have noticed that the Sun Fire v490 server with Solaris9 OS in my office, is showing a load of 12.50 during peak time and the CPU showing a max of 75% and an average of 60%.
The Application running in this machine hung last month(For reasons unknown) and is running fine after... (5 Replies)
Discussion started by: Renjesh
5 Replies
6. Shell Programming and Scripting
can someone suggest me some code in any language that will increase CPU and memory both. (3 Replies)
Discussion started by: learnbash
3 Replies
7. UNIX for Dummies Questions & Answers
Hi, I'm John_giova and I'm new in this Forum. Sorry my english, it's not my first language.
So, I'm trying to check the CPU utlization during the video encoding and decoding (making a comparison between SW and HW ) using the SAR tool. According to a past thread I saw as CPU utilization I should... (4 Replies)
Discussion started by: John_giova
4 Replies
8. Solaris
need to capture the following data on an hourly basis without cronjob scheduling in Solaris 5.10/5.11:-
1. load averages
2. Total no. of processes.
3. CPU state
4. Memory
5. Top 3 process details.
any other third-party tool is available? (7 Replies)
Discussion started by: thoranam
7 Replies
9. Ubuntu
Hello,
What I wish to succeed is to setup loadbalancing between two dedicated servers. Here is my case:
=======================================================================================================
LB IP (Just an IP address): Provided by hosting company (11.22.33.44) Hosting company... (1 Reply)
Discussion started by: baris35
1 Replies
10. Solaris
Hi all,
Been reading a lot of the cpu load and its "analogy of it to car traffic path of expressway"
From wiki
Most UNIX systems count only processes in the running (on CPU) or runnable (waiting for CPU) states. However, Linux also includes processes in uninterruptible sleep states... (13 Replies)
Discussion started by: javanoob
13 Replies
LEARN ABOUT OPENSOLARIS
igawk
IGAWK(1) Utility Commands IGAWK(1)
NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO
gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWgawk |
+--------------------+-----------------+
|Interface Stability | Volatile |
+--------------------+-----------------+
NOTES
Source for gawk is available on http://opensolaris.org.
Free Software Foundation Nov 3 1999 IGAWK(1)