03-21-2007
ip address octet increments
Hi all,
Situation is as below.
I would get an IP address and port from eithe r a file or command line. It probably would be as char * or string. So was wondering how I could accept this and increment the last octets?
Incrementing the port is fine. I could get that into an integer by atoi() and then increment it.
But the IP address part is getting tricky. Any say please?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a new challenge that I need some help with. Each morning I have two files that contain working units and failed units that I join together to form file3 which is FTP to server for comparison against billing system.
My problem, I would like to take joined data in file3 and add a field... (2 Replies)
Discussion started by: greengrass
2 Replies
2. UNIX and Linux Applications
Hi All,
I found my weblog contain entries like 121.23.3 Instead of four octet.
I am quite confused is it possible to have 3 octet ip at all ??
Is it generating by any program and hittng the website ?
Is it a subdomain ?
Please tell me your understanding on it ?
Thanks (4 Replies)
Discussion started by: jambesh
4 Replies
3. UNIX for Dummies Questions & Answers
I have a file that varies in the # of records. I want to read 1000 records, do something, read the next 1000 records, do something, going in 1000 increment chunks, and then finish up with whatever is left over at end of file. (1 Reply)
Discussion started by: Tsamp
1 Replies
4. Shell Programming and Scripting
Hi, I only have a very limited understanding and experience with writing code and I was hoping I could get some help.
I have a dataset of two columns (txt format, numbers in each row separated by a tab)
Eg.
1 5
2 5
3 6
4 7
5 6
6 6
7 ... (5 Replies)
Discussion started by: Emred_Skye
5 Replies
5. Shell Programming and Scripting
Hi All,
I am trying to implement a for loop in a .sh file and execute it.
My for loop is
for i in 1, 200, 400, 600, 800, 1000, 1200,......100000
do
...
..
..
done
As you could see there is an increment of 200 in each for loop until it reaches 100,000
Instead of specifying all the... (8 Replies)
Discussion started by: Lucky Ali
8 Replies
6. UNIX for Dummies Questions & Answers
I'm trying to learn as much about GRUB as I can and it's stages are stored in these types of files.
Any info or search terms is appreciated!:wall: (5 Replies)
Discussion started by: theKbStockpiler
5 Replies
7. Shell Programming and Scripting
Hi Experts,
I am trying to print $2 & the IP_address upto 3rd octet only.
But unable to do so, Trying # awk '{print $2, substr($4,1,9)}' file . but not correct
File:
HOST= cmiHOST06 :: 10.26.107.73:/data120 /nbu/cmiHOST06/athpx07/aa1
HOST= cmiHOST05 :: 10.26.12.76:/data120... (5 Replies)
Discussion started by: rveri
5 Replies
8. Shell Programming and Scripting
Experts,
In one example I have seen how to get output upto 3rd octet, when there is a ":" separated with the 4rth octet.
However in this example how to remove 4rth octet and to keep upto 3rd octet with regular expressions and awk sub function:
I have tried with :but not working:
# awk '{... (3 Replies)
Discussion started by: rveri
3 Replies
9. Programming
no longer needed, please delete thread. (0 Replies)
Discussion started by: xtina
0 Replies
10. Shell Programming and Scripting
Hello,
Im looking to help out my team by automating a simple search list. The user will look for a peering ip /30. For example 192.168.1.2/30 and gets the result. Im trying to get the entered /30 and subtract the last octet by one.
echo -n "Enter peering ip : "; read peeringip
cat... (3 Replies)
Discussion started by: D'go
3 Replies
LEARN ABOUT ULTRIX
socket_to_name
socket_to_name(3ncs) socket_to_name(3ncs)
Name
socket_to_name - convert a socket address to a name and port number
Syntax
#include <idl/c/socket.h>
void socket_$to_name(sockaddr, slength, name, nlength, port, status)
socket_$addr_t *sockaddr;
unsigned long slength;
socket_$string_t name;
unsigned long *nlength;
unsigned long *port;
status_$t *status;
Arguments
sockaddr A socket address. The socket address is the structure returned by either or
slength The length, in bytes, of sockaddr.
name A string in the format family:host[port], where family is the address family and host is the host name; host may be in
the standard numeric form (for example, #192.1.2.3) if a textual host name cannot be obtained. Currently, only ip is
supported for family.
nlength On input, the maximum length, in bytes, of the name to be returned. On output, the actual length of the name returned.
port The port number.
status The completion status. If the completion status returned in is equal to status_$ok , then the routine that supplied it
was successful.
Description
The routine converts a socket address to a textual address family, host name, and port number.
Files
See Also
intro(3ncs), socket_family_to_name(3ncs), socket_from_name(3ncs), socket_to_numeric_name(3ncs)
socket_to_name(3ncs)