Hi,
I want to write a sed script which from
batiato:
batiato/giubbe:
pip_b.2.txt
pip_b.3.txt
pip_b.3mmm.txt
bennato:
bennato/peterpan:
123.txt
consoli:
pip_a.12.txt
daniele: (2 Replies)
I'm new to using sed and grep commands, but have found them extremely useful. However I am having a hard time figuring this one out:
Delete every line containing the word CEN and the next line as well.
ie. test.txt
blue
324 CEN
green
red
blue
324 CEN
green
red
blue
to produce:... (2 Replies)
Hello friends!
Each line of my input file has this format:
word<TAB>tag1<blankspace>lemma<TAB>tag2<blankspace>lemma ... <TAB>tag3<blankspace>lemma
Of this file I need to eliminate all the repeated tags (of the same word) in a line, as in the example here below, but conserving both (all) the... (2 Replies)
Hi. I'm hoping that someone can help me with a bash script to delete a block of lines from a file.
What I want to do is delete every line between two stings that are the same,
including the line the first string is on but not the second.
(Marked lines to match with !)
For example if I... (2 Replies)
Hi. I have to delete the content between all the occurrences of the xml tags in a single file.
For example:
* The tags <script>.....................</script> occurs more than once in the same file.
* It follows tagging rules meaning a start tag will be followed by an end tag. Will not have... (9 Replies)
The question is not as simple as the title... I have a file, it looks like this
<string name="string1">RZ-LED</string>
<string name="string2">2.0</string>
<string name="string2">Version 2.0</string>
<string name="string3">BP</string>
I would like to check for duplicate entries of... (11 Replies)
here is what i want to achieve.. i have a file with below contents
cat fileName
blah blah blah
.
.DROP this
REJECT that
.
--sport 7800 -j REJECT --reject-with icmp-port-unreachable
--dport 7800 -j REJECT --reject-with icmp-port-unreachable
.
.
.
more blah blah blah
--dport 3306... (14 Replies)
Hi
I use sed comnand to remove occurance of one workd from a line.
However I need to removed occurance of dufferent words in ne line.
Original-1 Hi this is the END of my begining
Comand sed s/"END"/"start"/g
Output-1 Hi this is the start of my beginig
But I have more... (9 Replies)
Hi,
i need help to remove duplicates in my file. The problem is i need to delete one duplicate for each line only. the input file as follows and it is not tab delimited:-
The output need to remove 2nd word (in red) that duplicate with 1st word (in blue). Other duplicates should remained... (12 Replies)
Hi, I have multiple files on a directory with the following content:
blahblah
blahblah
hostname server1
blahblah
blahblah
---BEGIN---
aaa
bbb
ccc
ddd
---END---
blahblah
blahblah
blahblah
I would like to filter all the files with awk or sed or something else so I can get below... (6 Replies)
Discussion started by: bayupw
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)