08-30-2013
You might be limited to /bin/ed instead...
Good kuck...
For "printf" use "echo -e -n" instead, but I suspect you already know that... ;o)
This User Gave Thanks to wisecracker For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I need a sheet with the basic unix commands , and commands for VI editor. Does anyone know where i can get them. (3 Replies)
Discussion started by: Peter Spellman
3 Replies
2. UNIX for Dummies Questions & Answers
I'm training a newbie on unix. He's in another site and I can't share my unix books with him - is there any documentation on basic unix commands he can download? (1 Reply)
Discussion started by: kdgorton
1 Replies
3. Shell Programming and Scripting
I'm trying to make use of some common generic functions already present in the scripts loaded in the environment.
A variable VAR1 is declared and used in the generic functions.
Its value is also set in the generic function.
Now I need to use that generic function for PURGING of some old files... (2 Replies)
Discussion started by: livetaurean19
2 Replies
4. Windows & DOS: Issues & Discussions
Hi.
I'm New user for this Forum.Presently i'm working with Cygwin
I want to know the basic commands that will be used for Cygwin.
Can anyone guide me on this regards
Thanks & Regards
Sanjay (0 Replies)
Discussion started by: sanjay.karthik
0 Replies
5. UNIX for Dummies Questions & Answers
I would be thankful if anyone could show me commands to do the following tasks in vi:1) How can I undo or redo my last action in vi editor.
2) How can I copy only a word or a portion of line (not the whole line) in vi, like
we can select text and press ctrl+c in notepad to copy any text.
3)... (4 Replies)
Discussion started by: nervous
4 Replies
6. Red Hat
Hello out there!!!
I have a Red Hat Entreprise Linux 4 server and I am encountering this error
# grep
Segmentation Fault
I know it is not the right use of grep command, but I did that just for testing purpose,then I did
# which grep
/bin/grep
# ls -l /bin/grep
-rwxr-xr-x 1 root... (4 Replies)
Discussion started by: inhaki
4 Replies
7. Solaris
I want the commands list to view only files, and only directories and all the basic commands for a beginner of solaris (1 Reply)
Discussion started by: omsingh2k5
1 Replies
8. Android
In case you are interested, here is a partial list of linux-like commands on Android OS:
/sbin
adbd
devmgr
recovery
dfta
init
dfta.sh
fat.format
redbend_ua
/system/bin (partial list)
sh
date
netstat
mount
umount (0 Replies)
Discussion started by: Neo
0 Replies
9. UNIX for Dummies Questions & Answers
Hi I'm pretty new to scripting and I've been googling around looking for an answer but have yet to come up with a proper solution. I work with multiple android devices at a time and I'm looking to simplify my life with a script. Basically I'm looking for a script that takes the device ID's and then... (2 Replies)
Discussion started by: Onyoursix
2 Replies
10. Android
I am thinking of developing an app' for Android mobile devices...
Two questions here:-
1) Does anyone _develop_ for the Android _mobile_ platform?
If so do you use OSX 10.7.5 or greater as your _development_platform_?
2) I know ********* is gonna say that the Android terminal/shell is... (13 Replies)
Discussion started by: wisecracker
13 Replies
IP2LONG(3) 1 IP2LONG(3)
ip2long - Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address
SYNOPSIS
int ip2long (string $ip_address)
DESCRIPTION
The function ip2long(3) generates an IPv4 Internet network address from its Internet standard format (dotted string) representation.
ip2long(3) will also work with non-complete IP addresses. Read http://publibn.boul-
der.ibm.com/doc_link/en_US/a_doc_lib/libs/commtrf2/inet_addr.htm for more info.
PARAMETERS
o $ip_address
- A standard format address.
RETURN VALUES
Returns the IPv4 address or FALSE if $ip_address is invalid.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
|5.2.10 | |
| | |
| | Prior to this version, ip2long(3) would some- |
| | times return a valid number even if passed an |
| | value which was not an (IPv4) Internet Protocol |
| | dotted address. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
ip2long(3) Example
<?php
$ip = gethostbyname('www.example.com');
$out = "The following URLs are equivalent:<br />
";
$out .= 'http://www.example.com/, http://' . $ip . '/, and http://' . sprintf("%u", ip2long($ip)) . "/<br />
";
echo $out;
?>
Example #2
Displaying an IP address
This second example shows how to print a converted address with the printf(3) function in both PHP 4 and PHP 5:
<?php
$ip = gethostbyname('www.example.com');
$long = ip2long($ip);
if ($long == -1 || $long === FALSE) {
echo 'Invalid IP, please try again';
} else {
echo $ip . "
"; // 192.0.34.166
echo $long . "
"; // -1073732954
printf("%u
", ip2long($ip)); // 3221234342
}
?>
NOTES
Note
Because PHP's integer type is signed, and many IP addresses will result in negative integers on 32-bit architectures, you need to
use the "%u" formatter of sprintf(3) or printf(3) to get the string representation of the unsigned IP address.
Note
ip2long(3) will return FALSE for the IP 255.255.255.255 in PHP 5 <= 5.0.2. It was fixed in PHP 5.0.3 where it returns -1 (same as
PHP 4).
SEE ALSO
long2ip(3), sprintf(3).
PHP Documentation Group IP2LONG(3)