Not sure if this is strictly a unix issue, but in any case,......
What database are you using? There is likely a date/time function we can call in your query to produce your results straight off the bat.
Your logic of using a where clause based on being like '%/00', thrn '%/01' etc. could generate you spurious values.
Something like:
Might get you started and perhaps use of a trimming function to ignore the minutes value will get the actul result you want straight from the SQL query, but like I say, it depends on the database server you are using.
Wholly untested bit of theory, but I hope that this helps a bit. If you respond with the database software, you may get a complete response. In my opinion you would save processing time to get the database to perform the work within the initial query rather than get the data to a file then post-process it to create the output you want. You can use the to_char function of many databases to give you date/time output in the format you want too.
how would I write a command line that creates a new file named stuff.txt in the current working directory which contains the number of directories in the current working directory, followed by the number of empty files in the current working directory, followed by the name of the working directory? (3 Replies)
Hi
i data looks like this:
student 1
Subject1 45 55
Subject2 44 55
Subject3 33 44
//
student 2
Subject1 45 55
Subject2 44 55
Subject3 33 44
i would like to sum $2, $3 (marks) and divide each entry in $2 and $3 with their respective sums and print for each student as $4 and... (2 Replies)
Hi,
I have an array of strings. Each string has 4 comma separated values. I am binding this array to a SQL where I am required to do an INSERT after grouping.
The binding is done as :
$insertADWSth->bind_param_array(1,A_CONSTANT_STRING);... (1 Reply)
How do you do grouping in grep? Here's how I tried it at first:
egrep 'qualit(y|ies)' /usr/share/dict/words
-bash: syntax error near unexpected token `('
I'm using GNUgrep, and I found this on their site. grep regular expression syntax
So I tried this:
egrep 'qualit\(y\|ies\)'... (2 Replies)
Hi all,
I am using following command:
perl program.pl input.txt output.txt CUTOFF 3 > groups_3.txt
containing program.pl, two files (input.txt, output.txt) and getting output in groups_3.txt:
But, I wish to have 30 files corresponding to each CUTOFF ranging from 0 to 30 using the same... (1 Reply)
Hi Gurus,
I would like to do in a script something that is really easy in sql.
Basically, I have a file with a fomat like the following:
name1_test 501
name 1 33 510
test2 900
name1_test 300
So, I would like to group them as... (3 Replies)
awk 'FNR==NR {a; next} $NF in a' genes.txt refseq_exons.txt > output.txt
I can not figure out how to group the same name in $4 together.
Basically, all the SKI together in separate rows and all the TGFB2. Thank you :).
chr1 2160133 2161174 SKI
chr1 218518675 218520389 TGFB2... (1 Reply)
Hello,
I would like to group/sort a file of records by a particular field and then count how many records belong in that grouping.
For example say I have the following data:
1234|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|AA
ABCD|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|AA
EFGH|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|BB... (14 Replies)
Discussion started by: Nik44
14 Replies
LEARN ABOUT PHP
mysql_unbuffered_query
MYSQL_UNBUFFERED_QUERY(3) 1 MYSQL_UNBUFFERED_QUERY(3)mysql_unbuffered_query - Send an SQL query to MySQL without fetching and buffering the result rows.SYNOPSIS
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:
oSee: Buffered and Unbuffered queries
resource mysql_unbuffered_query (string $query, [resource $link_identifier = NULL])
DESCRIPTION mysql_unbuffered_query(3) sends the SQL query $query to MySQL without automatically fetching and buffering the result rows as
mysql_query(3) does. This saves a considerable amount of memory with SQL queries that produce large result sets, and you can start working
on the result set immediately after the first row has been retrieved as you don't have to wait until the complete SQL query has been per-
formed. To use mysql_unbuffered_query(3) while multiple database connections are open, you must specify the optional parameter $link_iden-
tifier to identify which connection you want to use.
o $query
- The SQL query to execute. Data inside the query should be properly escaped.
o $
link_identifier -The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect(3) is
assumed. If no such link is found, it will try to create one as if mysql_connect(3) was called with no arguments. If no connection
is found or established, an E_WARNING level error is generated.
For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_unbuffered_query(3) returns a resource on success, or FALSE on error.
For other type of SQL statements, UPDATE, DELETE, DROP, etc, mysql_unbuffered_query(3) returns TRUE on success or FALSE on error.
Note
The benefits of mysql_unbuffered_query(3) come at a cost: you cannot use mysql_num_rows(3) and mysql_data_seek(3) on a result set
returned from mysql_unbuffered_query(3), until all rows are fetched. You also have to fetch all result rows from an unbuffered SQL
query before you can send a new SQL query to MySQL, using the same $link_identifier.
mysql_query(3).
PHP Documentation Group MYSQL_UNBUFFERED_QUERY(3)