I'm not very familiar with the ssh command. When I tried to set a variable and then echo its value on a remote machine via ssh, I found a problem. For example,
$ ITSME=itsme
$ ssh xxx.xxxx.xxx.xxx "ITSME=itsyou; echo $ITSME"
itsme
$ ssh xxx.xxxx.xxx.xxx 'ITSME=itsyou; echo $ITSME'
itsyou
$... (3 Replies)
Hi All,
I have a tab delimited file where each of the strings have double quotes.
The problem is that I have records which are in the following format:
"TEXAS" ""HOUSTON"" "123" "" "2625-39-39"
""MAINE"" "" "456" "I" "3737-39-82"
I would have to output... (3 Replies)
Hi Experts,
I have a file with some of the records contain double quotes. If I found a double quote(") in any particular record , I need to look for the next double quote in that particular record and in between these quotes, if any comma(,) is there I need to replace with Tilde (~) in the same... (12 Replies)
Hi guys,
I desperately need some help here...
I need to parse a file similar to this:
I need to read the values for MY_BANNER_SSHD and WARNING_MESSAGE. The value could be empty/single line or multi-line!
# Comments
.
.
.
Some lines
MY_BANNER_SSHD=""... (7 Replies)
Unix superusers,
I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
I have one file a.txt as below.
a.txt
"aaas","111111","ewwee32e","deee333",
"aaas","111111","ewwee32e","deee333",
"aaas","111111","ewwee32e","deee333",
"aaas","111111","ewwee32e","deee333",
I want to write a script to process a.txt and want the output as below in different file as below -... (2 Replies)
Hi,
Trying to change the prompt. I have the following code.
export PS1='
<${USER}@`hostname -s`>$ '
The hostname is not displayed
<abc@`hostname -s`>$ uname -a
AIX xyz 1 6 00F736154C00
<adcwl4h@`hostname -s`>$
If I use double quotes, then the hostname is printed properly but... (3 Replies)
Hi,
I have
echo "start="\2014"">/tmp/read.txt
echo "end="2014"">>/tmp/read.txt
more /tmp/read.txt
start=2014
end=2014
But i wish to have double quotes in the read.txt
start="2014"
end="2014"
Can you please tell me how ? (1 Reply)
Hi All,
I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes.
Sample Data :
"221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Hi ALL,
file data like :
test.csv
a,b,"c,d"
my awk version is 4.0.2 ,if i am using the below code is working fine.
awk -vFPAT='(*)|("+")' -vOFS="," '{print $3}' test.csv
if the awk version is 3.1.7 is not working . Could you please help me on this one.
output should be : "c,d" (6 Replies)
Discussion started by: bmk123
6 Replies
LEARN ABOUT PHP
round
ROUND(3) 1 ROUND(3)round - Rounds a floatSYNOPSIS
float round (float $val, [int $precision], [int $mode = PHP_ROUND_HALF_UP])
DESCRIPTION
Returns the rounded value of $val to specified $precision (number of digits after the decimal point). $precision can also be negative or
zero (default).
Note
PHP doesn't handle strings like "12,300.2" correctly by default. See converting from strings.
PARAMETERS
o $val
- The value to round
o $precision
- The optional number of decimal digits to round to.
o $mode
- Use one of the following constants to specify the mode in which rounding occurs.
+--------------------+---------------------------------------------------+
| Constant | |
| | |
| | Description |
| | |
+--------------------+---------------------------------------------------+
| | |
| PHP_ROUND_HALF_UP | |
| | |
| | Round $val up to $precision decimal places away |
| | from zero, when it is half way there. Making 1.5 |
| | into 2 and -1.5 into -2. |
| | |
| | |
|PHP_ROUND_HALF_DOWN | |
| | |
| | Round $val down to $precision decimal places |
| | towards zero, when it is half way there. Making |
| | 1.5 into 1 and -1.5 into -1. |
| | |
| | |
|PHP_ROUND_HALF_EVEN | |
| | |
| | Round $val to $precision decimal places towards |
| | the next even value. |
| | |
| | |
|PHP_ROUND_HALF_ODD | |
| | |
| | Round $val to $precision decimal places towards |
| | the next odd value. |
| | |
+--------------------+---------------------------------------------------+
RETURN VALUES
The rounded value
EXAMPLES
Example #1
round(3) examples
<?php
echo round(3.4); // 3
echo round(3.5); // 4
echo round(3.6); // 4
echo round(3.6, 0); // 4
echo round(1.95583, 2); // 1.96
echo round(1241757, -3); // 1242000
echo round(5.045, 2); // 5.05
echo round(5.055, 2); // 5.06
?>
Example #2
$mode examples
<?php
echo round(9.5, 0, PHP_ROUND_HALF_UP); // 10
echo round(9.5, 0, PHP_ROUND_HALF_DOWN); // 9
echo round(9.5, 0, PHP_ROUND_HALF_EVEN); // 10
echo round(9.5, 0, PHP_ROUND_HALF_ODD); // 9
echo round(8.5, 0, PHP_ROUND_HALF_UP); // 9
echo round(8.5, 0, PHP_ROUND_HALF_DOWN); // 8
echo round(8.5, 0, PHP_ROUND_HALF_EVEN); // 8
echo round(8.5, 0, PHP_ROUND_HALF_ODD); // 9
?>
Example #3
$mode with precision examples
<?php
/* Using PHP_ROUND_HALF_UP with 1 decimal digit precision */
echo round( 1.55, 1, PHP_ROUND_HALF_UP); // 1.6
echo round( 1.54, 1, PHP_ROUND_HALF_UP); // 1.5
echo round(-1.55, 1, PHP_ROUND_HALF_UP); // -1.6
echo round(-1.54, 1, PHP_ROUND_HALF_UP); // -1.5
/* Using PHP_ROUND_HALF_DOWN with 1 decimal digit precision */
echo round( 1.55, 1, PHP_ROUND_HALF_DOWN); // 1.5
echo round( 1.54, 1, PHP_ROUND_HALF_DOWN); // 1.5
echo round(-1.55, 1, PHP_ROUND_HALF_DOWN); // -1.5
echo round(-1.54, 1, PHP_ROUND_HALF_DOWN); // -1.5
/* Using PHP_ROUND_HALF_EVEN with 1 decimal digit precision */
echo round( 1.55, 1, PHP_ROUND_HALF_EVEN); // 1.6
echo round( 1.54, 1, PHP_ROUND_HALF_EVEN); // 1.5
echo round(-1.55, 1, PHP_ROUND_HALF_EVEN); // -1.6
echo round(-1.54, 1, PHP_ROUND_HALF_EVEN); // -1.5
/* Using PHP_ROUND_HALF_ODD with 1 decimal digit precision */
echo round( 1.55, 1, PHP_ROUND_HALF_ODD); // 1.5
echo round( 1.54, 1, PHP_ROUND_HALF_ODD); // 1.5
echo round(-1.55, 1, PHP_ROUND_HALF_ODD); // -1.5
echo round(-1.54, 1, PHP_ROUND_HALF_ODD); // -1.5
?>
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | The $mode parameter was introduced. |
| | |
| 5.2.7 | |
| | |
| | The inner workings of round(3) was changed to |
| | conform to the C99 standard. |
| | |
+--------+---------------------------------------------------+
SEE ALSO ceil(3), floor(3), number_format(3).
PHP Documentation Group ROUND(3)