03-20-2015
Try also
Code :
awk '/E_TIM/ {CNT++}
{LN[CNT]; HD[$1]; MX[CNT,$1]=$2}
END { for (i in HD) printf "%10s", i; print "";
for (j in LN) {for (i in HD) printf "%10s", MX[j,i]; print ""}
}
' file
ETE E_TIM E_1 EOND E_2 E_3 E_4 EEC
15, 16, un, 26, un, un, 284, 81,
15, 17, un, 29, un, un, 249, 82,
This User Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
A file content have
1 1:-0.289433 2:0.833778 3:0.314471 4:-0.289433 5:-0.81876 6:-0.456693 7:-0.17511 8:-0.644555 9:-0.00666341 10:-1.13603
I will like to have that column into row with numbers to be printed (red color) only after colon
output shud be like that
-0.289433... (1 Reply)
Discussion started by: cdfd123
1 Replies
2. Shell Programming and Scripting
Hi,
I have a file named col.txt
1.000
2.000
3.000
4.000
5.000
6.000
7.000
8.000
I should get this
1.000 5.000
2.000 6.000
3.000 7.000 (10 Replies)
Discussion started by: G0Y
10 Replies
3. Shell Programming and Scripting
hi,
I have a requirement where in I read the values from a file using awk. The resulting data should be converted into row format from column format.
For ex: My log file login.lst contains the following
SERVER1 DB1
SERVER2 DB2
SERVER3 DB3
SERVER4 DB4
I use awk to grep only the server... (6 Replies)
Discussion started by: senthil3d
6 Replies
4. Shell Programming and Scripting
Hi Guys,
I have a file as follows:
a 1
b 786
c 90709
d 99
a 9875
b 989
c 887
d 111
I want:
a 1 9875
b 786 989 (3 Replies)
Discussion started by: npatwardhan
3 Replies
5. Shell Programming and Scripting
Hi Friends
I have the following input data in 2 columns.
SNo 1
I1 Value
I2 Value
I3 Value
SNo 2
I4 Value
I5 Value
I6 Value
I7 Value
SNo 3
I8 Value
I9 Value
...............
................
SNo N (1 Reply)
Discussion started by: ks_reddy
1 Replies
6. Shell Programming and Scripting
Hello,
I have an input file like the following:
11_3_4
2_1_35
3_15__
_16989
Where '_' is a space. The data is in a table. Is there a way for the program to prompt the user for x1,y1 and x2,y2, where x1,y1 is the desired number (for example x=6 y=4 is a value of 4) and move to a desired spot... (2 Replies)
Discussion started by: jl487
2 Replies
7. Shell Programming and Scripting
Hi,
I have a file like this
50 1 2 1374438
50 1 2 1682957
50 5 2 1453574
50 10 2 1985890
100 1 2 737307
100 5 2 1660204
100 10 2 2148483
and I want to convert this by... (1 Reply)
Discussion started by: gvj
1 Replies
8. UNIX for Advanced & Expert Users
Hi,
I want to convert a 3-column data to 3-row data using shell script. Any suggestion in this regard is highly appreciated.
Thanks. (4 Replies)
Discussion started by: sktkpl
4 Replies
9. Shell Programming and Scripting
Input file A.txt :-
C2062 -117.6 -118.5 -117.5
C5145 0 0 0
C5696 0 0 0
Output file B.txt
C2062 X -117.6
C2062 Y -118.5
C2062 Z -117.5... (4 Replies)
Discussion started by: asavaliya
4 Replies
10. Shell Programming and Scripting
Hi,
i need to convert
SG_ERP1
SG_ERP2
SG_ERP3
in to:
SG_ERP1 SG_ERP2 SG_ERP3
It's possibile? (16 Replies)
Discussion started by: elilmal
16 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 statements
SYNOPSIS
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)