02-25-2008
correct, but you may have to use -e option with echo to get the \c interpreted.
-ilan
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Basically I wanna take grep output,
EACH_OPTION_CHARGE: V033*, VMVM, 4.00, M
EACH_OPTION_CHARGE: V040*, VMVM, 4.00, M
EACH_OPTION_CHARGE: V042*, VMVM, 4.50, M
EACH_OPTION_CHARGE: V043*, VMVM, 5.00, M
EACH_OPTION_CHARGE: V050*, VMVM, 4.00, M
EACH_OPTION_CHARGE: V052*,... (1 Reply)
Discussion started by: djsal
1 Replies
2. Shell Programming and Scripting
hey gents,
I'm working on something that will use snmpwalk to query the devices on my network and retreive the device name, device IP, device model and device serial. I'm using Nmap for the enumeration and sed to clean up the results for use by snmpwalk. Once i get all the data organized I'm... (8 Replies)
Discussion started by: mitch
8 Replies
3. Shell Programming and Scripting
Hi,
Can anyone know how to use perl to merge the following multi-line information which beginning with "BAM" into one line. For each line need to delete the return and add a space. Please see the red color line.
******Org. Multi-line)
BAM admin 101.203.57.22 ... (3 Replies)
Discussion started by: happyday
3 Replies
4. Shell Programming and Scripting
Hello,
Did anyone know how to write a perl script to merge the multi-line into a single line where each line with start at timestamp
Input-->
timestamp=2009-11-10-04.55.20.829347;
a;
b;
c;
timestamp=2009-11-10-04.55.20.829347;
aa;
bb;
cc; (5 Replies)
Discussion started by: happyday
5 Replies
5. Shell Programming and Scripting
Hello
I did do a search and the past threads doesn't really solve my issue. (using various awk commands)
I need to combine the output from java -version into 1 line, but I am having difficulties.
When you exec java -version, you get:
java version "1.5.0_06"
Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies
6. Shell Programming and Scripting
Hi,
My Oracle query is returing below o/p
----------------------------------------------------------
Ins trnas value
a lkp1 x
a lkp1 y
b lkp1 a
b lkp2 x
b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I am trying to remove multi line and single line comments like examples below
I have tried this pattern. it works fine for single line comments and multi line comments in a single line only. but this fails when the comments are extended in multiple lines as shown in the comment 2 of... (3 Replies)
Discussion started by: ahmedwaseem2000
3 Replies
8. UNIX for Beginners Questions & Answers
example of problem:
when I echo "$e" >> /home/cogiz/file.txt
result prints to file as:AA
BB
CC
I need it to save to file as this:AA BB CC
I know it's probably something really simple but any help would be greatly appreciated.
Thank You.
Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies
9. Shell Programming and Scripting
Input File:
>Seq1
ASDADAFASFASFADGSDGFSDFSDFSDFSDFSDFSDFSDFSDFSDFSDFSD
>Seq2
SDASDAQEQWEQeqAdfaasd
>Seq3
ASDSALGHIUDFJANCAGPATHLACJHPAUTYNJKG
......
Desired Output File
>Seq1
ASDADAFASF
ASFADGSDGF
SDFSDFSDFS
DFSDFSDFSD
FSDFSDFSDF
SD
>Seq2 (4 Replies)
Discussion started by: patrick87
4 Replies
10. Shell Programming and Scripting
I want to read the log file which was generate from other command . And the output was having multi line in log files for job name and server name. But i need to make all the logs on one line
Source file
07/15/2018 17:02:00 TRANSLOG_1700 Server0005_SQL ... (2 Replies)
Discussion started by: ranjancom2000
2 Replies
BINDEC(3) 1 BINDEC(3)
bindec - Binary to decimal
SYNOPSIS
number bindec (string $binary_string)
DESCRIPTION
Returns the decimal equivalent of the binary number represented by the $binary_string argument.
bindec(3) converts a binary number to an integer or, if needed for size reasons, float.
bindec(3) interprets all $binary_string values as unsigned integers. This is because bindec(3) sees the most significant bit as another
order of magnitude rather than as the sign bit.
PARAMETERS
o $binary_string
- The binary string to convert
Warning
The parameter must be a string. Using other data types will produce unexpected results.
RETURN VALUES
The decimal value of $binary_string
EXAMPLES
Example #1
bindec(3) example
<?php
echo bindec('110011') . "
";
echo bindec('000110011') . "
";
echo bindec('111');
?>
The above example will output:
51
51
7
Example #2
bindec(3) interprets input as unsigned integers
<?php
/*
* The lesson from this example is in the output
* rather than the PHP code itself.
*/
$magnitude_lower = pow(2, (PHP_INT_SIZE * 8) - 2);
p($magnitude_lower - 1);
p($magnitude_lower, 'See the rollover? Watch it next time around...');
p(PHP_INT_MAX, 'PHP_INT_MAX');
p(~PHP_INT_MAX, 'interpreted to be one more than PHP_INT_MAX');
if (PHP_INT_SIZE == 4) {
$note = 'interpreted to be the largest unsigned integer';
} else {
$note = 'interpreted to be the largest unsigned integer
(18446744073709551615) but skewed by float precision';
}
p(-1, $note);
function p($input, $note = '') {
echo "input: $input
";
$format = '%0' . (PHP_INT_SIZE * 8) . 'b';
$bin = sprintf($format, $input);
echo "binary: $bin
";
ini_set('precision', 20); // For readability on 64 bit boxes.
$dec = bindec($bin);
echo 'bindec(): ' . $dec . "
";
if ($note) {
echo "NOTE: $note
";
}
echo "
";
}
?>
Output of the above example on 32 bit machines:
input: 1073741823
binary: 00111111111111111111111111111111
bindec(): 1073741823
input: 1073741824
binary: 01000000000000000000000000000000
bindec(): 1073741824
NOTE: See the rollover? Watch it next time around...
input: 2147483647
binary: 01111111111111111111111111111111
bindec(): 2147483647
NOTE: PHP_INT_MAX
input: -2147483648
binary: 10000000000000000000000000000000
bindec(): 2147483648
NOTE: interpreted to be one more than PHP_INT_MAX
input: -1
binary: 11111111111111111111111111111111
bindec(): 4294967295
NOTE: interpreted to be the largest unsigned integer
Output of the above example on 64 bit machines:
input: 4611686018427387903
binary: 0011111111111111111111111111111111111111111111111111111111111111
bindec(): 4611686018427387903
input: 4611686018427387904
binary: 0100000000000000000000000000000000000000000000000000000000000000
bindec(): 4611686018427387904
NOTE: See the rollover? Watch it next time around...
input: 9223372036854775807
binary: 0111111111111111111111111111111111111111111111111111111111111111
bindec(): 9223372036854775807
NOTE: PHP_INT_MAX
input: -9223372036854775808
binary: 1000000000000000000000000000000000000000000000000000000000000000
bindec(): 9223372036854775808
NOTE: interpreted to be one more than PHP_INT_MAX
input: -1
binary: 1111111111111111111111111111111111111111111111111111111111111111
bindec(): 18446744073709551616
NOTE: interpreted to be the largest unsigned integer
(18446744073709551615) but skewed by float precision
NOTES
Note
The function can convert numbers that are too large to fit into the platforms integer type, larger values are returned as float in
that case.
SEE ALSO
decbin(3), octdec(3), hexdec(3), base_convert(3).
PHP Documentation Group BINDEC(3)