I'm hoping someone can help me on this. I have a data file that greatly simplified might look like this:
sec;src;dst;proto
421;10.10.10.1;10.10.10.2;tcp
426;10.10.10.3;10.10.10.4;udp
442;10.10.10.5;10.10.10.6;tcp
sec;src;fac;dst;proto
521;10.10.10.1;ab;10.10.10.2;tcp... (3 Replies)
hi, i have an awk script and I managed to figure out how to search the max value but Im having difficulty in searching for the min field value.
BEGIN {FS=","; max=0}
NF == 7 {if (max < $6) max = $6;}
END { print man, min}
where $6 is the column of a field separated by a comma (3 Replies)
Hello everybody,
I'm trying to count the number of consecutive lines in a text file which have two distinctive column field values. These lines may appear in several line blocks within the file, but I only want a single block to be counted.
This was my first approach to tackle the problem (I'm... (6 Replies)
Hi,
Here is my sample input
X 2 AAA
Y 3 BBB
Y 2 CCC
Z 4 DDD
In field 1, if the value of one line is same as that of next line, I want to concatenate the corresponding value of the second line in the third field with the value of the third field of first line. And I dont need the third... (2 Replies)
Hi Experts,
I am new to shell scripting. Need some help in doing one task given by the customer.
The sample record in a file is as follows:
3538,,,,,,ID,ID1,,,,,,,,,,,
It needs to be the following:
3538,,353800,353800,,,ID,ID1,,,,,COLX,,,,,COLY,
And i want to modify this record in... (3 Replies)
Hello there,
I have a file with few fields separated by ":". I wrote a below awk to manipulate this file:
awk 'BEGIN { FS=OFS=":" }\
NR != 1 && $2 !~ /^98/ && $8 !~ /^6/{print $0}' $in_file > $out_file
What I wanted was that if $8 field contains any of the values - 6100, 6110, 6200 -... (2 Replies)
Hi all !
I almost did it but got a small problem.
input:
cars red
cars blue
cars green
truck black
Wanted:
cars red-blue-green
truck black
Attempt:
gawk 'BEGIN{FS="\t"}{a = a (a?"-":"")$2; $2=a; print $1 FS $2}' input
But I also got the intermediate records... (2 Replies)
Input:
A|1
B|2
C|3
D|4
Output:
A+B|3
A+C|4
A+D|5
B+C|5
B+D|6
C+D|7
A+B+C|6
A+B+D|7
A+C+D|8
B+C+D|9
A+B+C+D|10
I only managed to get the output for pairs of $1 values (i.e. combination of length 2): (4 Replies)
Hi Friends,
Below is my input file with "|" (pipe) as filed delimiter:
My Input File:
HDR|F1|F2||||F6|F7
I want to inser values in the record for field 4 and field 5.
Expected output
HDR|F1|F2||F4|F5|F6|F7
I am able to append the string to the end of the record, but not in between the... (3 Replies)
My program run without error. The problem I am having.
The program isn't outputting field values with the column headers to file.txt.
Each of the column headers in file.txt has no data.
MEMSIZE SECOND SASFoundation Filename
The output results in file.txt should show:
... (1 Reply)
Discussion started by: dellanicholson
1 Replies
LEARN ABOUT PHP
cubrid_next_result
CUBRID_NEXT_RESULT(3) 1 CUBRID_NEXT_RESULT(3)cubrid_next_result - Get result of next query when executing multiple SQL statementsSYNOPSIS
bool cubrid_next_result (resource $result)
DESCRIPTION
The cubrid_next_result(3) function is used to get results of next query if multiple SQL statements are executed and CUBRID_EXEC_QUERY_ALL
flag is set upon cubrid_execute(3).
PARAMETERS
o $result
-$result comes from a call to cubrid_execute(3)RETURN VALUES
TRUE, when process is successful.
FALSE, when process is unsuccessful.
EXAMPLES
Example #1
cubrid_next_result(3) example
<?php
$conn = cubrid_connect("127.0.0.1", 33000, "demodb", "dba");
$sql_stmt = "SELECT * FROM code; SELECT * FROM history WHERE host_year=2004 AND event_code=20281";
$res = cubrid_execute($conn, $sql_stmt, CUBRID_EXEC_QUERY_ALL);
get_result_info($res);
cubrid_next_result($res);
get_result_info($res);
function get_result_info($req)
{
printf("
------------ get_result_info --------------------
");
$row_num = cubrid_num_rows($req);
$col_num = cubrid_num_cols($req);
$column_name_list = cubrid_column_names($req);
$column_type_list = cubrid_column_types($req);
$column_last_name = cubrid_field_name($req, $col_num - 1);
$column_last_table = cubrid_field_table($req, $col_num - 1);
$column_last_type = cubrid_field_type($req, $col_num - 1);
$column_last_len = cubrid_field_len($req, $col_num - 1);
$column_1_flags = cubrid_field_flags($req, 1);
printf("%-30s %d
", "Row count:", $row_num);
printf("%-30s %d
", "Column count:", $col_num);
printf("
");
printf("%-30s %-30s %-15s
", "Column Names", "Column Types", "Column Len");
printf("------------------------------------------------------------------------------
");
$size = count($column_name_list);
for($i = 0; $i < $size; $i++) {
$column_len = cubrid_field_len($req, $i);
printf("%-30s %-30s %-15s
", $column_name_list[$i], $column_type_list[$i], $column_len);
}
printf("
");
printf("%-30s %s
", "Last Column Name:", $column_last_name);
printf("%-30s %s
", "Last Column Table:", $column_last_table);
printf("%-30s %s
", "Last Column Type:", $column_last_type);
printf("%-30s %d
", "Last Column Len:", $column_last_len);
printf("%-30s %s
", "Second Column Flags:", $column_1_flags);
printf("
");
}
?>
The above example will output:
------------ get_result_info --------------------
Row count: 6
Column count: 2
Column Names Column Types Column Len
------------------------------------------------------------------------------
s_name char 1
f_name varchar 6
Last Column Name: f_name
Last Column Table: code
Last Column Type: varchar
Last Column Len: 6
Second Column Flags:
------------ get_result_info --------------------
Row count: 4
Column count: 5
Column Names Column Types Column Len
------------------------------------------------------------------------------
event_code integer 11
athlete varchar 40
host_year integer 11
score varchar 10
unit varchar 5
Last Column Name: unit
Last Column Table: history
Last Column Type: varchar
Last Column Len: 5
Second Column Flags: not_null primary_key unique_key
SEE ALSO cubrid_execute(3).
PHP Documentation Group CUBRID_NEXT_RESULT(3)