Need to print duplicate row along with highest version of original
There are some duplicate field on description column .I want to print duplicate row along with highest version of number and corresponding description column.
Just dusted off an old version of the Byte UNIX Benchmarks from our old benchmark days at http://linux.silkroad.com/ and ran them against www.unix.com:
==============================================================
BYTE UNIX Benchmarks (Version 3.11)
System -- Linux www 2.4.20 #2 Mon... (0 Replies)
sorry for my English
We'll report about Unix in my school, for Operating Systems subject...
with Installation demo....
I'm wondering if System V, which is from original developers AT&T still exist
and downloadable? because I cant find it anywhere...
then i found out that Solaris, MacOS... (4 Replies)
How do I make tar set the correct atime on the extracted version? The option --atime-preserve works just on the original, not on the extracted file.
The extracted files always have current time as atime, which is bad. (10 Replies)
I am completely new to shell scripting but have been assigned the task of creating several batch files to manipulate data. My final task requires me to find lines that have duplicates present then delete not only the duplicate but the original as well. The script will be used in a windows... (9 Replies)
Hi everyone,
This is my first post, but I have already received a lot of help from the forums in the past. Thanks!
I've searched the forums and my question is very similar to an earlier post entitled "Printing highest value from one column", which I am apparently not yet allowed to post a... (1 Reply)
Hi,
I have a requirement where I have to remove duplicates from a file based on the first 8 chars (It is fixed width file of 10 chars length) and whenever a duplicate row is found, its original row's last 2 chars should be updated to all 0's.
I thought of using
sort -u -k 1.1,1.8... (4 Replies)
Hi,
I have a huge text file with filenames which which looks like the following ie uniquenumber_version_filename:
e.g.
1234_1_xxxx
1234_2_vfvfdbb
343333_1_vfvfdvd
2222222_1_ggggg
55555_1_xxxxxx
55555_2_vrbgbgg
55555_3_grgrbr
What I need to do is examine the file, look for... (4 Replies)
Hi All,
Need help here, can you tell me the syntax to line grep the highest file version?
0 04-05-2016 08:00 lib/SBSSchemaProject.jar/schemas/
0 04-05-2016 08:00 lib/SBSSchemaProject.jar/schemas/airprice/
0 04-05-2016 08:00 ... (2 Replies)
Hi, I have a little issue right now.
I have a file with 4 columns
test0000002,10030010330,c_,218
test0000002,10030010330,d_,202
test0000002,10030010330,b_,193
test0000002,10030010020,c_,178
test0000002,10030010020,b_,170
test0000002,10030010330,a_,166
test0000002,10030010020,a_,151... (3 Replies)
Discussion started by: Ebk
3 Replies
LEARN ABOUT PHP
mysql_fetch_array
MYSQL_FETCH_ARRAY(3) 1 MYSQL_FETCH_ARRAY(3)mysql_fetch_array - Fetch a result row as an associative array, a numeric array, or bothSYNOPSIS
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should
be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
omysqli_fetch_array(3)
o PDOStatement::fetch
array mysql_fetch_array (resource $result, [int $result_type = MYSQL_BOTH])
DESCRIPTION
Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.
o $
result -The result resource that is being evaluated. This result comes from a call to mysql_query(3).
o $result_type
- The type of array that is to be fetched. It's a constant and can take the following values: MYSQL_ASSOC, MYSQL_NUM, and
MYSQL_BOTH.
Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. The type of returned array depends on
how $result_type is defined. By using MYSQL_BOTH (default), you'll get an array with both associative and number indices. Using
MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc(3) works), using MYSQL_NUM, you only get number indices (as
mysql_fetch_row(3) works).
If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of the
same name, you must use the numeric index of the column or make an alias for the column. For aliased columns, you cannot access the con-
tents with the original column name.
Example #1
Query with aliased duplicate field names
SELECT table1.field AS foo, table2.field AS bar FROM table1, table2
Example #2
mysql_fetch_array(3) with MYSQL_NUM
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("ID: %s Name: %s", $row[0], $row[1]);
}
mysql_free_result($result);
?>
Example #3
mysql_fetch_array(3) with MYSQL_ASSOC
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
printf("ID: %s Name: %s", $row["id"], $row["name"]);
}
mysql_free_result($result);
?>
Example #4
mysql_fetch_array(3) with MYSQL_BOTH
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
printf ("ID: %s Name: %s", $row[0], $row["name"]);
}
mysql_free_result($result);
?>
Note
Performance
An important thing to note is that using mysql_fetch_array(3) is not significantly slower than using mysql_fetch_row(3), while it
provides a significant added value.
Note
Field names returned by this function are case-sensitive.
Note
This function sets NULL fields to the PHP NULL value.
mysql_fetch_row(3), mysql_fetch_assoc(3), mysql_data_seek(3), mysql_query(3).
PHP Documentation Group MYSQL_FETCH_ARRAY(3)