...
In my xyz_abc.sql file there are multiple blocks.
Just imagine there are 25 blocks in xyz_abc.sql file in that block I need to find the following block.
...
(1) Yes but how is this block different from the other 24 ? You will need this information in order to identify and replace this block correctly (out of the 25).
(2) Are all the blocks identical ? If so, which block do you want replaced ? The 1st, 2nd, 25th ? Or all ?
To give us a better idea, post a short excerpt of your target file that clearly demonstrates the difference(s) between the block of interest and the rest.
Hello
I am a beginner in shell script.
I was trying to find a way to replace multiple lines of a file with different set of multiple line.
sed -n '/begin/,/end/p' < sample1.txt >test.txt
UNEDITED=`cat test.txt`
vi test.txt
EDITED=`cat test.txt`... (2 Replies)
I am new to linux and would like to modify the contents of a file preferably using a one line. The situation is as follows
<start>
some lines
"I am the string"
"replace string"
more lines here
<end>
In the above example,On encountering "I am the string", the "replace string "should be... (6 Replies)
Hi,
I am creating a script to do a find and replace single/multiple lines in a file with any number of lines.
I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE
print $FIND gives
Hi How r $u
Rahul()
Note:... (0 Replies)
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
I am writing it another way to make it clear,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Can someone tell me how I can do this?
e.g:
Say file1.txt contains:
today is monday
the 22 of
NOVEMBER
2010
and file2.txt contains:
the
11th
month
of
How do i replace the word NOVEMBER with (5 Replies)
I have a section of text in file A, see below
# falkdjf lkjadf lkjadf
lkajdf lkajdf lkajdf lkjadf
lkjadf 234.234.2.234
lkjlkjlk 234.234.3.234
#
Only the first line with "# falkdjf lkjadf lkjadf" is unique in the file. The new section that I want to overwrite the old section above is in... (1 Reply)
Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ?
The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories.
So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Hi,
I have a log file which has sessionids in it, each block in the log starts with a date entry, a block may be a single line or multiple lines. I need to sed (or awk) out the lines/blocks with that start with a date and include the session id.
The files are large at several Gb.
My... (3 Replies)
I want to find common line in two files and replace the next line of first file with the next line of second file. (sed,awk,perl,bash any solution is welcomed ) Case Ignored. Multiple Occurrence of same line.
File 1:
hgacdavd
sndm,ACNMSDC
msgid "Rome"
msgstr ""
kgcksdcgfkdsb... (4 Replies)
Hello,
I have some code that works more or less. This is called by a make file to adjust some hard-coded definitions in the src code. The script generated some values by looking at some of the src files and then writes those values to specific locations in other files. The awk code is used to... (3 Replies)
Discussion started by: LMHmedchem
3 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 rowSYNOPSIS
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)