I have a file like: myfile.txt
it is easy to learn awk and begin awk scripting
and awk has got many features
awk is a powerful text processing tool
Now i want to get the text between first awk and immediate awk not the third awk . How to get it ? its urgent pls help me and file is unevenly... (2 Replies)
Hallo
I have maybe a little bit advanced request....
I need to choose one random part betwen %....
so i have this..
%
text1 text1 text1
text1 text1 text1
text1 text1 text1
%
text2 text2
text2 text2 text2
%
text3 text3 text3
tetx3
%
this choose text between %
awk ' /%/... (8 Replies)
I have a text wich looks like this:
clid=2 cid=6 client_database_id=35 client_nickname=Peter client_type=0|clid=3 cid=22 client_database_id=57 client_nickname=Paul client_type=0|clid=5 cid=22 client_database_id=7 client_nickname=Mary client_type=0|clid=6 cid=22 client_database_id=6... (3 Replies)
Hi All,
From the title you may know that this question has been asked several times and I have done lot of Googling on this.
I have a Wikipedia dump file in XML format. All the contents are in one XML file i.e. all different topics have been put in one XML file. Now I need to separate them and... (1 Reply)
Hi,
I want to extract some text between two strings in a line i am using following command i.e;
awk '/-string1/,/-string2/' filename
contents of file is---
line1
line2
aaa -bbb -ccc -string1 c,d,e -string2
line4
but it is showing complete line which is having searched strings.
aaa... (19 Replies)
Hi I have something like this:
EXAMPLE 1
CREATE UNIQUE INDEX "STRING_1"."STRING_2" ON "BOSNI_CAB_EVENTO"
("CD_EVENTO" , "CD_EJECUCION" ) PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 5242880 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "DB1000_INDICES_512K"... (4 Replies)
Hi All,
I have a file whose common patter is like this:
.I 1
.U
87049087
.S
Some text here too
.M
This is a text
.T
Some another text here
.P
Name of the book
.W
Some lines of more text. This text needs to be extracted.
.A
more text goes here too
.I 2 (2 Replies)
Hi,
I have a text like these:
ECHO "BEGGINING THE SHELL....."
MV FILE1 > FILE2
UNIQ_ID=${1}
PARTITION_1=`${PL}/Q${CON}.KSH "SELECT ....."
PARTITION_2=`${PL}/Q${CON}.KSH "SELECT ........"
${PL}/Q${CON}.KSH "CREATE ...."
IF ....
.......
I would like to extract only text that only... (4 Replies)
Discussion started by: mierdatuti
4 Replies
LEARN ABOUT PHP
pg_fetch_array
PG_FETCH_ARRAY(3)PG_FETCH_ARRAY(3)pg_fetch_array - Fetch a row as an arraySYNOPSIS
array pg_fetch_array (resource $result, [int $row], [int $result_type = PGSQL_BOTH])
DESCRIPTION pg_fetch_array(3) returns an array that corresponds to the fetched row (record).
pg_fetch_array(3) is an extended version of pg_fetch_row(3). In addition to storing the data in the numeric indices (field number) to the
result array, it can also store the data using associative indices (field name). It stores both indicies by default.
Note
This function sets NULL fields to the PHP NULL value.
pg_fetch_array(3) is NOT significantly slower than using pg_fetch_row(3), and is significantly easier to use.
PARAMETERS
o $result
- PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
o $row
- Row number in result to fetch. Rows are numbered from 0 upwards. If omitted or NULL, the next row is fetched.
o $result_type
- An optional parameter that controls how the returned array is indexed. $result_type is a constant and can take the following
values: PGSQL_ASSOC, PGSQL_NUM and PGSQL_BOTH. Using PGSQL_NUM, pg_fetch_array(3) will return an array with numerical indices,
using PGSQL_ASSOC it will return only associative indices while PGSQL_BOTH, the default, will return both numerical and associa-
tive indices.
RETURN VALUES
An array indexed numerically (beginning with 0) or associatively (indexed by field name), or both. Each value in the array is represented
as a string. Database NULL values are returned as NULL.
FALSE is returned if $row exceeds the number of rows in the set, there are no more rows, or on any other error.
EXAMPLES
Example #1
pg_fetch_array(3) example
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occurred.
";
exit;
}
$result = pg_query($conn, "SELECT author, email FROM authors");
if (!$result) {
echo "An error occurred.
";
exit;
}
$arr = pg_fetch_array($result, 0, PGSQL_NUM);
echo $arr[0] . " <- Row 1 Author
";
echo $arr[1] . " <- Row 1 E-mail
";
// As of PHP 4.1.0, the row parameter is optional; NULL can be passed instead,
// to pass a result_type. Successive calls to pg_fetch_array will return the
// next row.
$arr = pg_fetch_array($result, NULL, PGSQL_ASSOC);
echo $arr["author"] . " <- Row 2 Author
";
echo $arr["email"] . " <- Row 2 E-mail
";
$arr = pg_fetch_array($result);
echo $arr["author"] . " <- Row 3 Author
";
echo $arr[1] . " <- Row 3 E-mail
";
?>
SEE ALSO pg_fetch_row(3), pg_fetch_object(3), pg_fetch_result(3).
PHP Documentation Group PG_FETCH_ARRAY(3)