How do I extract 5th to 10th characters of string as given below stored in a shell variable.
"ab cd ef gh ij kl"
How is cut to be used on this?
Thanks for any help. (1 Reply)
Is there a way that i can get something like this to work:
Number=`expr 80 \* 10.69`
i.e. To multiply an integer by a decimal or a decimal by a decimal etc...?
thanks (10 Replies)
Hi,
Need to extract a string from one file and search the same in other files.
Ex:
I have file1 of hundred lines with no delimiters not even space.
I have 3 more files.
I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get... (1 Reply)
Hello. I have a problem with AWK and floats below 0 in a script.
It may be simplified to this line (please, take into account that my "locale" is Spanish, so the system will read "," as decimal separator):
echo -1,25 2,55745 0,33 ,278 | awk '{print $1+1, $2+1, $3+1, $4+1}'... getting:
-0,25... (4 Replies)
I am trying to extract a hyperlink from a html document using awk. I have managed to output in the format... href="index.html"> where i would like it just to output index.html. Any ideas on how i would do this?
Thanks (2 Replies)
I am using gawk in a dos shell in windows xp and want to read a datafile and reformat it.
The datafile consists of columns of integers, floating point numbers and text strings. Each column is a fixed width and each column contains the same data type, eg all integers, all text.
I am looking for a... (0 Replies)
I want to make computations using floats. This cannot be done with csh. ksh seem to have a problem as well. What is good shell for computations without having to resort to bc or awk? How about python? (5 Replies)
Hi,
I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Hello,
I have two files.
File 1 is a list of interested IDs
Ex1
Ex2
Ex3File 2 is the original file with over 8000 columns and 20 millions rows and is a compressed file .gz
Ex1 xx xx xx xx ....
Ex2 xx xx xx xx ....
Ex2 xx xx xx xx ....Now I need to extract the information for all the IDs of... (4 Replies)
Hello.
First best wishes for everybody.
here is the input file ("$INPUT1") contents :
BASH_FUNC_message_begin_script%%=() { local -a L_ARRAY;
BASH_FUNC_message_debug%%=() { local -a L_ARRAY;
BASH_FUNC_message_end_script%%=() { local -a L_ARRAY;
BASH_FUNC_message_error%%=() { local... (3 Replies)
Discussion started by: jcdole
3 Replies
LEARN ABOUT DEBIAN
sg_get_cpu_stats
sg_get_cpu_stats(3) Library Functions Manual sg_get_cpu_stats(3)NAME
sg_get_cpu_stats, sg_get_cpu_stats_diff, sg_get_cpu_percents - get cpu usage
SYNOPSIS
#include <statgrab.h>
sg_cpu_percents *sg_get_cpu_percents(void);
sg_cpu_stats *sg_get_cpu_stats(void);
sg_cpu_stats *sg_get_cpu_stats_diff(void);
DESCRIPTION
sg_get_cpu_stats() and sg_get_cpu_stats_diff() both return static pointers of type sg_cpu_stats. sg_get_cpu_stats() returns the total
amount of "ticks" the operating system has spent in each of the different states. sg_get_cpu_stats_diff() returns the difference in "ticks"
for each of the states since last time sg_get_cpu_stats_diff() or sg_get_cpu_stats() was called. If it has never been called, it will
return the result of sg_get_cpu_stats().
The value stored (the "ticks") will vary between operating systems. For example Solaris has a total of 100 per second, while Linux has sub-
stantially more. Also, different operating systems store different information - you won't find nice cpu on Solaris for example.
Because of this, you will ideally always want to work on a scale against the total, or in percentages.
sg_get_cpu_percents() returns a pointer to a static sg_cpu_percents. The function calls sg_get_cpu_stats_diff() and changes the values into
percentages. If it has never been called before (and nor has sg_get_cpu_stats() or sg_get_cpu_stats_diff()), the returned percentages will
be the systems total ever since its uptime. (Unless the counters have cycled)
RETURN VALUES
There are two structures returned by the CPU statistics functions.
typedef struct{
long long user;
long long kernel;
long long idle;
long long iowait;
long long swap;
long long nice;
long long total;
time_t systime;
}sg_cpu_stats;
typedef struct{
float user;
float kernel;
float idle;
float iowait;
float swap;
float nice;
time_t time_taken;
}sg_cpu_percents;
user kernel idle iowait swap nice
The different CPU states.
systime time_taken
The time taken in seconds since the last call of the function, or the system time.
SEE ALSO statgrab(3)WEBSITE
http://www.i-scream.org/libstatgrab/
i-scream $Date: 2005/04/25 11:25:45 $ sg_get_cpu_stats(3)