09-23-2015
is there a way to specify the row number? I would like to change only one row+column
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
i need to change character case inside a script file. How i can do that?
any fucntion?
thanks (3 Replies)
Discussion started by: ajaya
3 Replies
2. Shell Programming and Scripting
I know this is strictly a programming forum - but I consider vi a programming enabler and the question relates to regex you'd use with awk/sed anyway....
I have a file which is 50,000+ lines long and need to change many many instances of
word_word_word
to be
word+word+word
where... (6 Replies)
Discussion started by: Brett Taylor
6 Replies
3. Solaris
dears
i am using solaris 10
i am facing a problem when i make setup for solaris i choose the country egypt and i select the language north america
but i forget to do that the i found the date Jun written in arabic
i want to change character set to written in english
-rw-r--r-- 1 root ... (4 Replies)
Discussion started by: hosney00ux
4 Replies
4. Shell Programming and Scripting
Good morning,
i have two chaines of characters to be reversed in shell script (red with blue).
It was only one line.
Can you help me to write a script in awk or sed?
... (2 Replies)
Discussion started by: khalidou13
2 Replies
5. Shell Programming and Scripting
Hi,
Someone can help me please,
i have text in file like this:
(a,b,c,d,e),
(f,g,h,i,j),
(k,l,m,n,o),
and i want to change the last character to like this:
(a,b,c,d,e),
(f,g,h,i,j),
(k,l,m,n,o);
last array character "," i want change to ";"
anyone can help me please,,
thanks (2 Replies)
Discussion started by: ryo
2 Replies
6. HP-UX
Hi Experts,
I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line.
File is comma (,) seperated.
Eg:
ID,Client ,SNo,Rank
37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies
7. Solaris
I get a file which has all its content in a single row.
The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file.
I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies
8. UNIX for Dummies Questions & Answers
I need help removing the last character of every line if it is a certain character. For example I need to get rid of a % character if it is in the last position.
Input:
aaa%
%bbb
ccc
d%dd%
Output should be:
aaa
%bbb
ccc
d%dd
I tried this but it gets rid of all of the % characters.... (5 Replies)
Discussion started by: raptor25
5 Replies
9. Shell Programming and Scripting
Hi there,
A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis).
The original file would look like... (3 Replies)
Discussion started by: bnbsd
3 Replies
10. Shell Programming and Scripting
Hi friend,
I have one file , and i want to read that file character by character.
I need this script in ksh.
while using read option with -n1 am getting error.
while read -n1 c read has bad option
And if i am using below script, then if in a line has space like this ( Pallvi mahajan)... (10 Replies)
Discussion started by: pallvi_mahajan
10 Replies
LEARN ABOUT PHP
db2_fetch_array
DB2_FETCH_ARRAY(3) 1 DB2_FETCH_ARRAY(3)
db2_fetch_array - Returns an array, indexed by column position, representing a row in a result set
SYNOPSIS
array db2_fetch_array (resource $stmt, [int $row_number = -1])
DESCRIPTION
Returns an array, indexed by column position, representing a row in a result set. The columns are 0-indexed.
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 a 0-indexed array with column values indexed by the column position 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_array(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_array($stmt)) {
printf ("%-5d %-16s %-32s %10s
",
$row[0], $row[1], $row[2], $row[3]);
}
?>
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_array(3) from a scrollable cursor
If your result set uses a scrollable cursor, you can call db2_fetch_array(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_array($result, $i)) {
printf ("%-5d %-16s %-32s %10s
",
$row[0], $row[1], $row[2], $row[3]);
$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_assoc(3), db2_fetch_both(3), db2_fetch_object(3), db2_fetch_row(3), db2_result(3).
PHP Documentation Group DB2_FETCH_ARRAY(3)