03-28-2008
Hi
Means I have a file called test.txt
with:-
Num Measure
108 0.05
12 0.45
13 0.2
19 0.5
And in my bash I will grep a random number which match the Num column in test.txt. (e.g getting random number of Num value of 2,4,6,8,10,12) from test.txt. In test.txt, the element 12 of Num matches with the random number which I wanted to retrieve.This step i think should be find by grep command.
Next, I would like to find the minimum of measure before the element num 12 and measure 0.45 line. In this case, the output would be 0.05 since only one element is there ebfore the Num 12 and measure 0.45.
Another example; let say my random number to retrieve is 19 of test.txt. I I wanted to find the elements of Measure which gives the minimum value.
In this example; the possible value to be minimum (not including the measure which belongs to random number) are:-
0.05,0.45,0.2
Final output would be 0.05 since its the minimum among these 3 values.
Hope i dont confused you. Feel free to let me know if youre still unsure. Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi, i have a large text file that I just want to extract the important
information from. It will be a random number of lines but between two specific
line numbers/markers.
I was thinking I could get the line number for the first marker:
Tablespace Percent Total Free
Then get the line... (11 Replies)
Discussion started by: Da_Duck
11 Replies
2. Shell Programming and Scripting
Hello i'm writting a krn shell that will find the letter F and I would like to grab everything from F till 0:00. Is there a sed or awk command that i could use.
Thank you. File is looks like this.
11/12 xxx xxxx xxx F xxxx xxxx
some info entered here
some info entered here
xxxx... (1 Reply)
Discussion started by: wisher115
1 Replies
3. Shell Programming and Scripting
suppose u have a file
AAAAAKKSKSKMSKMSKBNNSHNKSNJNMSYNMSBH
This is exactly wht the input is like
Question is i want to list wht is on the line 5 tht will be A
but Remember u want to extract in between say from 100 to 300
i tried using
awk 'BEGIN {FS=""} {print$100,$300}' file
but it will... (1 Reply)
Discussion started by: cdfd123
1 Replies
4. Shell Programming and Scripting
In a shell script, I need to grab the first or second line after a search string in a file. For example:
File.out:
Random Info
Manufacturer: XYZPDQ
System Info
Manufacturer: Hewlett-Packard
Product Name: ProLiant
I search for the word FILE, I want to be able to grab the line... (1 Reply)
Discussion started by: jwk1230
1 Replies
5. Shell Programming and Scripting
Hi Guys
I have the following file
Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above:
Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies
6. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
7. Shell Programming and Scripting
Hi,
I have a file like this
>hg19_chr1_123_456_+
asndbansbdahsjdbfsjhfghjdsghjdghjdjhdghjjdkhfsdkjfhdsjkdkjghkjdhgfjkhjfkf
hasjgdhjsgfhjdsgfdsgfjhdgjhdjhdhjdfhjdfjgfdfbdghjbfjksdhfjsfdghjgdhjgfdjhgd
jhgdfj
>hg19_chr1_123_456_-... (5 Replies)
Discussion started by: jacobs.smith
5 Replies
8. Shell Programming and Scripting
so i have a data file that has various lines which may or may not end with spaces or tabs.
data.file:
, \t \t
{sample} <spaces> <spaaces> several more spaces....
{"resemble"}, <nospaces>
Command i'm using:
sed -n 8p data.file | egrep "\],$|\],\ $"
or
egrep "\],$|\],\ $"... (1 Reply)
Discussion started by: SkySmart
1 Replies
9. Shell Programming and Scripting
Hello,
I have a text file in the below format:
Source Destination State Lag Status
CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies
10. Shell Programming and Scripting
data:
8iW5iPACIb5fafafEU24f3EOOjpakx6VwxBX+NafafxJMWX8iW5iPACIb5fafafEU24f3EOOjpakx6VwxBX+NafafxJMWX8iW5i
PACIb5fafafEU24f3EOOjpakx6VwxBX+NafafxJMWX8iW5iPACIb5fafafEU24f3EOOjpakx6VwxBX+
8nwR15UzfeZafaf2bGr8akx6VwxBX+NafafxJMWX8iW5iPACIb5fafafEU24f3EOOjp
lVpOoMLXJ ... (19 Replies)
Discussion started by: SkySmart
19 Replies
LEARN ABOUT PHP
cubrid_num_rows
CUBRID_NUM_ROWS(3) 1 CUBRID_NUM_ROWS(3)
cubrid_num_rows - Get the number of rows in the result set
SYNOPSIS
int cubrid_num_rows (resource $result)
DESCRIPTION
The cubrid_num_rows(3) function is used to get the number of rows from the query result. You can use it only when the query executed is a
select statement. When you want to know such value for INSERT, UPDATE, or DELETE query, you have to use the cubrid_affected_rows(3) func-
tion.
Note: The cubrid_num_rows(3) function can only be used for synchronous query; it returns 0 when it is used for asynchronous query.
PARAMETERS
o $result
-$result comes from a call to cubrid_execute(3), cubrid_query(3) and cubrid_prepare(3)
RETURN VALUES
Number of rows, when process is successful.
0 when the query was done in async mode.
-1, if SQL statement is not SELECT.
FALSE when process is unsuccessful.
EXAMPLES
Example #1
cubrid_num_rows(3) example
<?php
$conn = cubrid_connect("localhost", 33000, "demodb", "dba");
$req = cubrid_execute($conn, "SELECT * FROM code");
$row_num = cubrid_num_rows($req);
$col_num = cubrid_num_cols($req);
printf("Row Num: %d
Column Num: %d
", $row_num, $col_num);
cubrid_disconnect($conn);
?>
The above example will output:
Row Num: 6
Column Num: 2
SEE ALSO
cubrid_execute(3), cubrid_num_cols(3), cubrid_affected_rows(3).
PHP Documentation Group CUBRID_NUM_ROWS(3)