Hi,
The following command provides the usage in 1024-byte blocks
du -ks * | sort -n | echo "$1"
...
1588820 user10
2463140 user11
2464096 user12
5808484 user13
6387400 user14
.....
I am trying to produce an output of first coulmn by multiplying by 1024 so that the output should... (11 Replies)
it must be late because I'm sure this is an easy task with grep sed or awk
string would be anything mixing numbers letters and ) ( =
output I need is just the numbers... but I just can't seem to get it to work.
Any tips would be great :) (10 Replies)
This is my script. I am pulling the status of some hard where, but the status is in numerical form. The number 4 means Major and the 5 means Critical. In my script I would like to show the alarm type in aplha rather than numeric form. So if instead of seeing a 4 or 5 you would see MAjor or... (11 Replies)
Here is what I am trying to do:
I have a list of numbers that I pulled from an awk command in a column like so:
1
3
4
7
8
I want to find which numbers in the list are missing out of a range. So let's say I want to find out from the list above which numbers are missing from the... (6 Replies)
Howdy experts,
We have some ranges of number which belongs to particual group as below.
GroupNo StartRange EndRange
Group0125 935300 935399
Group2006 935400 935476
937430 937459
Group0324 935477 935549
... (6 Replies)
Hello,
For my weather station I have made a little perl script to put the data into cacti. The next problem I have.
I can only get positive numbers or negative numbers.
What do I do:
Though a shell scrip I call the perl script.
Shell script:
#!/bin/sh
cat data.txt | stats.pl
Perl... (4 Replies)
Add 35 to the 3rd col (12000) in input if it is "+" and it will be 12035 in output.
Some thing like
awk '{if ($3==+) print $2,$3,$3+35,$1 else print $2,$3-35,$3,$1}'
+ abc1 12000
- abc2 10000
+ xyz1 11111
- vbcx 20036
+ xy_z 33333
output
abc1 ... (2 Replies)
i have a file, let's call it file.
march 2008 january 2008
march 1920 march 2002
i want to output the first line, not the second as you can see the second line has different numbers. (8 Replies)
Patches have the following syntax: Patchxxxx.xxx where x is a number. I'm trying to strip the .xxx off of the patch, so I tried this:
sed 's/PATCH./Patch/' patchin.log > patchout.log
But that of course changed Patchxxxx.xxx to Patch. Ooops, what is the syntax i'm looking for?
thanks (3 Replies)
Hi,
my data is like the subsequent snipped. Fieldseperator is TAB.
I can work the data well with awk, but the missing zero-numbers at the days column, for the days smaller 10 and the full hour-minutes i cant handle in the output.
2012 7 1 8 40 249.463 245.01 5.70448 6.11388 6.22125... (2 Replies)
Discussion started by: IMPe
2 Replies
LEARN ABOUT PHP
mysql_db_query
MYSQL_DB_QUERY(3) 1 MYSQL_DB_QUERY(3)mysql_db_query - Selects a database and executes a query on itSYNOPSIS
Warning
This function was deprecated in PHP 5.3.0, and will be removed in the future, along with the entirety of the original MySQL exten-
sion. 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_select_db(3) then the query
o PDO::__construct
resource mysql_db_query (string $database, string $query, [resource $link_identifier = NULL])
DESCRIPTION mysql_db_query(3) selects a database, and executes a query on it.
o $database
- The name of the database that will be selected.
o $query
- The MySQL query. 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.
Returns a positive MySQL result resource to the query result, or FALSE on error. The function also returns TRUE/ FALSE for INSERT/ UPDATE/
DELETE queries to indicate success/failure.
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | This function now throws an E_DEPRECATED notice. |
| | |
+--------+---------------------------------------------------+
Example #1
mysql_db_query(3) alternative example
<?php
if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('mysql_dbname', $link)) {
echo 'Could not select database';
exit;
}
$sql = 'SELECT foo FROM bar WHERE id = 42';
$result = mysql_query($sql, $link);
if (!$result) {
echo "DB Error, could not query the database
";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row['foo'];
}
mysql_free_result($result);
?>
Note
Be aware that this function does NOT switch back to the database you were connected before. In other words, you can't use this
function to temporarily run a sql query on another database, you would have to manually switch back. Users are strongly encouraged
to use the database.table syntax in their sql queries or mysql_select_db(3) instead of this function.
mysql_query(3), mysql_select_db(3).
PHP Documentation Group MYSQL_DB_QUERY(3)