Sponsored Content
Top Forums Shell Programming and Scripting Compare IP addresses and increment Post 302859813 by jethrow on Friday 4th of October 2013 12:57:58 AM
Old 10-04-2013
Code:
ip=`head -n1 file.dat`					# read ip address from file
end=${ip##*\.}						# delete everthing before last dot (leaving 234/235)

while (( end++ < 254 )); do				# while the 234/235 is less than 254 (increment each time tested)
	printf 134.123.3.$end"\r\n" >> NewFile.txt	# append your incremented ip address to NewFile.txt
done


Last edited by jethrow; 10-04-2013 at 02:11 AM..
This User Gave Thanks to jethrow For This Post:
 

10 More Discussions You Might Find Interesting

1. IP Networking

ip addresses

this might sound corny but i need help finding out about finding a persons ip address can u halp? and another question what the hell does ping mean??? thank u. (2 Replies)
Discussion started by: dragonslayer100
2 Replies

2. IP Networking

Ip Addresses

I'm not exactly sure what I can do with IPs... my friend won't tell me(don't ask me why, I figure it's cause he doesn't know either, hehe). I'm curious as to what theya re used for other than networking computers... if there IS any other purpose or use for them. That's all. --Evil_d00d (4 Replies)
Discussion started by: evil_d00d
4 Replies

3. Shell Programming and Scripting

increment an integer

hi I want to echo the variable $i while it auto-increments till 21 I set initially i to 1 any idea how to do that? thank you (4 Replies)
Discussion started by: melanie_pfefer
4 Replies

4. Shell Programming and Scripting

Increment value (starttime)

Hi All, I have created a script... #!/bin/sh datafile=ABC2008101601.OUT indfile=ABCIND20081016.1.OUT waittime=600 starttime=0 while do if then echo "Indicator file has arrived." break else sleep 10; ((starttime=$starttime+10)) echo $starttime (2 Replies)
Discussion started by: Amit.Sagpariya
2 Replies

5. UNIX for Dummies Questions & Answers

Different ip addresses

Hello! I have logged in using Putty into another machine 'tele'. The ip address which i used to login to 'tele' is 192.168.1.3. Now while at 'tele' when i run "#ifconfig -a" i get the same ip address i.e, 192.168.1.3. But when i run "#arp tele" it gives the output: tele (10.143.128.8) ... (9 Replies)
Discussion started by: suhail.sadaqat
9 Replies

6. Shell Programming and Scripting

Awk - Compare fields and increment variables

Hi, My first post to this group... I have a need to to parse a source file which is a capture from a network analyser. I have two fields that need to be checked: - Field 7 represents the packet length (an integer), and Field 4 represents a network address (e.g. 192.168.25.3) - The... (10 Replies)
Discussion started by: mv652
10 Replies

7. Shell Programming and Scripting

Increment Gawk

Hi, I have a small query with gawk which i'm unsure how to solve. My csv input data is as follows: 1 58352.9 34549 -469.323 LINE_149 2 58352.9 34499 -469.323 LINE_149 3 58352.9 34549 -469.323 LINE_151 4 58352.9 34503.4 -489.841 LINE_151 5 58352.9 34549 -469.323 LINE_152 6 58352.9... (1 Reply)
Discussion started by: theflamingmoe
1 Replies

8. Shell Programming and Scripting

Bash arrays that compare ip addresses.

I've been trying to have an array of ip addresses go through a loop one at a time. Then compare if the current element is in another array of ip addresses. I've traced my error with /bin/bash -x + for c in '"${ip}"' ./netk5: line 65: 50.17.231.23 23.64.146.110 23.64.159.139 107.14.36.129... (17 Replies)
Discussion started by: Azrael
17 Replies

9. Shell Programming and Scripting

Increment time

I have to increment time ... by sec but i am getting the output like this. for m in {2..3} > do > for (( i = 1; i <= 13; i++ )) > do > echo "$m:$i" > done > done 2:1 2:2 2:3 2:4 2:5 2:6 2:7 2:8 (2 Replies)
Discussion started by: kalyankalyan
2 Replies

10. Shell Programming and Scripting

Increment the password value

I want a script which increments the count when the script runs. Basically I want to send an password reset email notification for an application, the password value should be keep on changing whenever the script is executed for example, first time i execute it should be password1, second time... (2 Replies)
Discussion started by: JAGADESH GN
2 Replies
edge(8) 							SUPERUSER COMMANDS							   edge(8)

NAME
edge - n2n edge node daemon SYNOPSIS
edge [-d <tun device>] -a <tun IP address> -c <community> -k <encrypt key> -l <supernode host:port> [-p <local port>] [-u <UID>] [-g <GID>] [-f] [-m <MAC address>] [-t] [-r] [-v] DESCRIPTION
N2N is a peer-to-peer VPN system. Edge is the edge node daemon for n2n which creates a TAP interface to expose the n2n virtual LAN. On startup n2n creates the TAP interface and configures it then registers with the supernode so it can begin to find other nodes in the commu- nity. OPTIONS
-d <name> sets the TAP device name as seen in ifconfig. -a <addr> sets the n2n virtual LAN IP address being claimed. This is a private IP address. All IP addresses in an n2n community should belong to the same /24 network (ie. only the last segment of the IP addresses varies). -b cause edge to perform hostname resolution for the supernode address each time the supernode is periodically contacted. -c <community> sets the n2n community name. All edges within the same community look to be on the same LAN (layer 2 network segment). All edges communicating must use the same key and community name. -h write usage to tty then exit. -k <keystring> sets the twofish encryption key from ASCII text (see also N2N_KEY in ENVIRONMENT). All edges communicating must use the same key and community name. -l <addr>:<port> sets the n2n supernode IP address and port to register to. -p <num> binds edge to the given UDP port. Useful for keeping the same external socket across restarts of edge. -u <uid> causes the edge process to drop to the given user ID when privileges are no longer required. -g <gid> causes the edge process to drop to the given group ID when privileges are no longer required. -f causes the edge process to fork and run as a daemon, closing stdin, stdout, stderr and becoming a process group leader. -m <MAC> start the TAP interface with the given MAC address. This is highly recommended as it means the same address will be used if edge stops and restarts. If this is not done, the ARP caches of all peers will be wrong and packets will not flow to this edge until the next ARP refresh. -M <MTU> set the MTU of the edge interface in bytes. MTU is the largest packet fragment size allowed to be moved throught the interface. The default is 1400. -s <netmask> set the netmask of edge interface in IPv4 dotted decimal notation. The default is 255.255.255.0 (ie. /24). -t use HTTP tunneling instead of the normal UDP mechanism (experimental). -r enable packet forwarding/routing through the n2n virtual LAN. Without this option, packets arriving over n2n which are not for the -a <addr> IP address are dropped. -v use verbose logging. ENVIRONMENT
N2N_KEY set the encryption key so it is not visible on the command line EXAMPLES
edge -d n2n0 -c mynetwork -k encryptme -u 99 -g 99 -m DE:AD:BE:EF:01:23 -a 192.168.254.7 -p 50001 -l 123.121.120.119:7654 Start edge with TAP device n2n0 on community "mynetwork" with community supernode at 123.121.120.119 UDP port 7654 and bind the locally used UDP port to 50001. Use "encryptme" as the shared encryption key. Assign MAC address DE:AD:BE:EF:01:23 to the n2n inter- face and drop to user=99 and group=99 after the TAP device is successfull configured. Add the -f option to make edge run as a daemon. Somewhere else setup another edge with similar parameters, eg. edge -d n2n0 -c mynetwork -k encryptme -u 99 -g 99 -m DE:AD:BE:EF:01:21 -a 192.168.254.5 -p 50001 -l 123.121.120.119:7654 Now you can ping from 192.168.254.5 to 192.168.254.7. The MAC address (-m <MAC>) and virtual IP address (-a <addr>) must be different on all edges in the same community. CONFIGURATION
All configuration for edge is from the command line and environment variables. If you wish to reconfigure edge you should kill the process and restart with the desired options. EXIT STATUS
edge is a daemon and any exit is an error. AUTHOR
Luca Deri ( deri (at) ntop.org ), Richard Andrews ( andrews (at) ntop.org ), Don Bindner SEE ALSO
ifconfig(8) supernode(1) tunctl(8) revision 3679 Jan 3, 2009 edge(8)
All times are GMT -4. The time now is 01:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy