12-08-2011
the while statement ought to work but may not be the fastest way to do it.
In what way is awk "not working"?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear All
I am facing below mention problem plz suggest me solution.
Op of date command:
> date
Tue Jan 1 12:17:52 IST 2008
Now i want Jan 1 12: or Jan 1 12 op in some another variable.
I had tried awk but if give me problem when there is date comes in 2 digit i.e. greater that 9.... (1 Reply)
Discussion started by: jaydeep_sadaria
1 Replies
2. Shell Programming and Scripting
Hi,
I am trying to extract all .sql files present in a particular directory and its sub directories. How can i do this using shell script or awk?
any help would be earnestly appreciated.
thanks. (1 Reply)
Discussion started by: sprinleo
1 Replies
3. Shell Programming and Scripting
Hi I am going to migrate our datawarehouse system from HP Tru 64 Unix to the Red Hat Linux.
Inside the box, it is running around 40 cron jobs; inside each cron job, it is calling other shell script files, and the shell script files may again call other shell script files or ctl files(for... (1 Reply)
Discussion started by: franksubramania
1 Replies
4. Shell Programming and Scripting
Hello all,
I have a shell script that uses multiple .sql files. These .sql files mainly contain Oracle SQL queries to pull fields from the database. I want to place all the contents of these .sql files in one .sql file and have some parameter sent based on which the respective block or query... (6 Replies)
Discussion started by: snvniranjanrao
6 Replies
5. Shell Programming and Scripting
HI I ma using perl programming
my perl is like this
$InputFile = $ENV{UDE_TMP} . "/" ."cre_fmr_gen.temp_data_file_gen.dat";
@duplicates = `cat $InputFile | cut -d "|" -f 1,1 | sort | uniq -c | awk '{ if(\$1>1) {print \$2;}}'`;
my $cusiplist ;
foreach $cusip (@duplicates)
{... (1 Reply)
Discussion started by: ptappeta
1 Replies
6. UNIX for Advanced & Expert Users
I have a data like as follows, I need to format it as shown in as below. Request you to help me here ?
I/P
aa|3|1
aa|4|2
bb|3|1
bb|4|1
cc|3|26
cc|4|1
O/P
aa|3|1|4|2
bb|3|1|4|1
cc|3|26|4|1
Thanks,
Srikanth (5 Replies)
Discussion started by: srikanth38
5 Replies
7. Shell Programming and Scripting
I tried executing set of queries from shell script but not able to capture the input query in the log file,but the input query is not displayed along with output. Only the outputs are being captured in the log file. Is there a way to capture the input query along with the corresponding input?? (8 Replies)
Discussion started by: pallvi_mahajan
8 Replies
8. Programming
I need help to create varieties of football formation. The available positions are:
GK
SW
DR
DC
DL
WBR
DM
WBL
MR
MC
ML
AMR
AMC
AML
ST
But the conditions are:
a. the maximum number in 1 formation:
GK is 1
SW is 1 (1 Reply)
Discussion started by: Tzeronone
1 Replies
9. Shell Programming and Scripting
I'm trying to create a perl script that will automatically fit the player's name to the formation.
For example, in my:
DR.txt
Arbeloa 200
Carvajal 190
Ramos 180
DC.txt
Ramos 200
Pepe 190
Varane 180
DL.txt
Marcelo 200
Coentrao 190
Arbeloa 180
formation.txt:
DR
DC
DC
DL
DR (7 Replies)
Discussion started by: Tzeronone
7 Replies
10. Programming
https://www.unix.com/programming/252468-perl-script-create-football-formation.html https://www.unix.com/members/43551.html, it is not repeated question. please read it before u block my question. Unblock it for me. Thanks:mad: (0 Replies)
Discussion started by: Tzeronone
0 Replies
LEARN ABOUT PHP
db2_fetch_row
DB2_FETCH_ROW(3) 1 DB2_FETCH_ROW(3)
db2_fetch_row - Sets the result set pointer to the next row or requested row
SYNOPSIS
bool db2_fetch_row (resource $stmt, [int $row_number])
DESCRIPTION
Use db2_fetch_row(3) to iterate through a result set, or to point to a specific row in a result set if you requested a scrollable cursor.
To retrieve individual fields from the result set, call the db2_result(3) function.
Rather than calling db2_fetch_row(3) and db2_result(3), most applications will call one of db2_fetch_assoc(3), db2_fetch_both(3), or
db2_fetch_array(3) to advance the result set pointer and return a complete row as an array.
PARAMETERS
o $stmt
- A valid stmt resource.
o $row_number
- With scrollable cursors, you can request a specific row number in the result set. Row numbering is 1-indexed.
RETURN VALUES
Returns TRUE if the requested row exists in the result set. Returns FALSE if the requested row does not exist in the result set.
EXAMPLES
Example #1
Iterating through a result set
The following example demonstrates how to iterate through a result set with db2_fetch_row(3) and retrieve columns from the result
set with db2_result(3).
<?php
$sql = 'SELECT name, breed FROM animals WHERE weight < ?';
$stmt = db2_prepare($conn, $sql);
db2_execute($stmt, array(10));
while (db2_fetch_row($stmt)) {
$name = db2_result($stmt, 0);
$breed = db2_result($stmt, 1);
print "$name $breed";
}
?>
The above example will output:
cat Pook
gold fish Bubbles
budgerigar Gizmo
goat Rickety Ride
Example #2
i5/OS recommended alternatives to db2_fetch_row/db2_result
On i5/OS it is recommended that you use db2_fetch_both(3), db2_fetch_array(3), or db2_fetch_object(3) over
db2_fetch_row(3)/db2_result(3). In general db2_fetch_row(3)/db2_result(3) have more issues with various column types in EBCIDIC to
ASCII translation, including possible truncation in DBCS applications. You may also find the performance of db2_fetch_both(3),
db2_fetch_array(3), and db2_fetch_object(3) to be superior to db2_fetch_row(3)/db2_result(3).
<?php
$conn = db2_connect("","","");
$sql = 'SELECT SPECIFIC_SCHEMA, SPECIFIC_NAME, ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE, ROUTINE_CREATED, ROUTINE_BODY, IN_PARMS, OUT_PARMS, INOUT_PARMS, PARAMETER_STYLE, EXTERNAL_NAME, EXTERNAL_LANGUAGE FROM QSYS2.SYSROUTINES FETCH FIRST 2 ROWS ONLY';
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_both($stmt)){
echo "<br>db2_fetch_both {$row['SPECIFIC_NAME']} {$row['ROUTINE_CREATED']} {$row[5]}";
}
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_array($stmt)){
echo "<br>db2_fetch_array {$row[1]} {$row[5]}";
}
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_object($stmt)){
echo "<br>db2_fetch_object {$row->SPECIFIC_NAME} {$row->ROUTINE_CREATED}";
}
db2_close($conn);
?>
The above example will output:
db2_fetch_both MATCH_ANIMAL 2006-08-25-17.10.23.775000 2006-08-25-17.10.23.775000
db2_fetch_both MULTIRESULTS 2006-10-17-10.11.05.308000 2006-10-17-10.11.05.308000
db2_fetch_array MATCH_ANIMAL 2006-08-25-17.10.23.775000
db2_fetch_array MULTIRESULTS 2006-10-17-10.11.05.308000
db2_fetch_object MATCH_ANIMAL 2006-08-25-17.10.23.775000
db2_fetch_object MULTIRESULTS 2006-10-17-10.11.05.308000
SEE ALSO
db2_fetch_array(3), db2_fetch_assoc(3), db2_fetch_both(3), db2_fetch_object(3), db2_result(3).
PHP Documentation Group DB2_FETCH_ROW(3)