Hi, I need some help in text manipulation.
I have an input file like this:
7629 "WPCW 19 - CW/AM1, WPCB 40 - FAMN/CORNER, WPCB-DT1 50 - FAMN/CORNER, "
W35AW - Various Shopping Pgms
W41CF - TBN
W47CV - TBN
WLLS-LP 49 - AM1
WATCH WPXI 11 N & WPIX 11 CW
1234 "WPCW 19 - CW/AM1,... (26 Replies)
I want to have a terminal open and have something like a "repeating cat" command running in it for a certain text file (in particular /var/log/system.log). So my terminal will scan or cat the text file every so often or whenever the text file system.log gets written to by the system, it will... (1 Reply)
Is there any way to erase all the contents of a specific line of a text file and then write something on it?
e.g.
test.txt.old:
qwert
asdfg
zxcbv=0
test.txt.new
qwerty
asdfg
hello=0
is this possible with C++ ?:confused: (1 Reply)
Mac OS X 10.6: Leopard - I'm trying to create a script that will run on its own that can edit system preferences. I've done some digging, and found that a lot of system preference options are controlled by .plist files in ~/library/preferences, /library/preferences, and... (1 Reply)
Dear Members,
I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input.
The contents of a single cell of INFO column is like:
Area:app - aam
Clean Up Criteria:... (0 Replies)
I have a text file that has data like:
Data "12345#22"
Fred
ID 12345
Age 45
Wilma
Dino
Data "123#22"
Tarzan
ID 123
Age 33
Jane
I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes:
Data "1012345#22"
Fred
ID... (16 Replies)
Dear Guru's
I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response.
Srini (6 Replies)
Hello All,
I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly.
Is there any way to take the output from the cat... (7 Replies)
Good morning all, I have a machine running IRIX and I need to edit a text file on the terminal that is literally thousands of lines. Does anyone know the most efficient way to edit portions of files like these? Obviously simply using the vi command isn't going to work since I get a too many lines... (1 Reply)
Discussion started by: James C
1 Replies
LEARN ABOUT PHP
db2_fetch_assoc
DB2_FETCH_ASSOC(3) 1 DB2_FETCH_ASSOC(3)db2_fetch_assoc - Returns an array, indexed by column name, representing a row in a result setSYNOPSIS
array db2_fetch_assoc (resource $stmt, [int $row_number = -1])
DESCRIPTION
Returns an array, indexed by column name, representing a row in a result set.
PARAMETERS
o $stmt
- A valid stmt resource containing a result set.
o $row_number
- Requests a specific 1-indexed row from the result set. Passing this parameter results in a PHP warning if the result set uses a
forward-only cursor.
RETURN VALUES
Returns an associative array with column values indexed by the column name representing the next or requested row in the result set.
Returns FALSE if there are no rows left in the result set, or if the row requested by $row_number does not exist in the result set.
EXAMPLES
Example #1
Iterating through a forward-only cursor
If you call db2_fetch_assoc(3) without a specific row number, it automatically retrieves the next row in the result set.
<?php
$sql = "SELECT id, name, breed, weight FROM animals ORDER BY breed";
$stmt = db2_prepare($conn, $sql);
$result = db2_execute($stmt);
while ($row = db2_fetch_assoc($stmt)) {
printf ("%-5d %-16s %-32s %10s
",
$row['ID'], $row['NAME'], $row['BREED'], $row['WEIGHT']);
}
?>
The above example will output:
0 Pook cat 3.20
5 Rickety Ride goat 9.70
2 Smarty horse 350.00
Example #2
Retrieving specific rows with db2_fetch_assoc(3) from a scrollable cursor
If your result set uses a scrollable cursor, you can call db2_fetch_assoc(3) with a specific row number. The following example
retrieves every other row in the result set, starting with the second row.
<?php
$sql = "SELECT id, name, breed, weight FROM animals ORDER BY breed";
$result = db2_exec($stmt, $sql, array('cursor' => DB2_SCROLLABLE));
$i=2;
while ($row = db2_fetch_assoc($result, $i)) {
printf ("%-5d %-16s %-32s %10s
",
$row['ID'], $row['NAME'], $row['BREED'], $row['WEIGHT']);
$i = $i + 2;
}
?>
The above example will output:
0 Pook cat 3.20
5 Rickety Ride goat 9.70
2 Smarty horse 350.00
SEE ALSO db2_fetch_array(3), db2_fetch_both(3), db2_fetch_object(3), db2_fetch_row(3), db2_result(3).
PHP Documentation Group DB2_FETCH_ASSOC(3)