Sponsored Content
Full Discussion: return IP address
Top Forums UNIX for Dummies Questions & Answers return IP address Post 302248918 by drl on Monday 20th of October 2008 06:14:47 AM
Old 10-20-2008
Hi.

Some versions of cut allow this:
Code:
#!/bin/bash -

# @(#) s1       Demonstrate sub-string extraction, character replacement.

echo
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1) cut sed
set -o nounset

echo
echo " Results:"
echo "192.29.0.131" |
cut -d"." -f3- |
sed -e 's/\./_/;s/^/_/'

exit 0

Producing:
Code:
% ./s1

(Versions displayed with local utility "version")
Linux 2.6.11-x1
GNU bash 2.05b.0
cut (coreutils) 5.2.1
GNU sed version 4.1.2

 Results:
_0_131

The GNU and Solaris cut seem to accept this ... cheers, drl
 

10 More Discussions You Might Find Interesting

1. IP Networking

pine username return address

hello all I am happily using pine but unhappily sending email as username@where.my.mail.works instead of ****@my.college.edu well, my username on my computer is one thing, but my username on my college account (**** here) is different. what I'm trying to do is use the college server for... (1 Reply)
Discussion started by: plusran
1 Replies

2. Programming

Return IP address

Not sure whether this is an appropriate request, however, Using C++ code I'm running a unix command from the pc that needs the IP address of the PC in order to set the DISPLAY variable. The code is written using Builder C++ (Borland) but I'm having difficulty finding what functions / header... (3 Replies)
Discussion started by: gefa
3 Replies

3. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

4. Shell Programming and Scripting

Read Hostname and Return IP Address

Dear Experts, I have a text file on my itanium box which contains list of nearly 1000 hostnames. I do not have the IP Address of them. I want read each entry from the text file and want to do a nslookup to the DNS Server and get the IP Adresses and put them in another file in the format... (1 Reply)
Discussion started by: PrasannaKS
1 Replies

5. UNIX for Dummies Questions & Answers

Panic kernal-mode address fault on user address 0x14

:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message: PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14 KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD) EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies

6. Shell Programming and Scripting

Validate an IP address - Return to menu

hi! I need a script that, among other things, presents a menu to the user, checks the user input for an IP address (in quad dotted notation), and then "redirects" (with sed) that IP address to the Firewall script. The script must check that all of the inputs are valid IP addresses (numeric,... (1 Reply)
Discussion started by: zetetic
1 Replies

7. Shell Programming and Scripting

Need to get return code from mutt if an address is invalid/undeliverable from Unix shell script

I am using mutt on ksh Unix to send emails to addresses plucked from the database. If the "To:" email address is not longer valid and so the email is not sent to the "To:" recipient, but is sent to the valid cc address, I need to be able to get an error code returned to the shell script so that... (3 Replies)
Discussion started by: jzuber
3 Replies

8. IP Networking

Set default return address for all mails sent from mailx

Hi, I have a question about mailx in Red Hat: If I use 'mail userid@mydomain.com -- -f root@mydomain.com', the return mail address will be root@mydomain.com. How can I make all mails sent from this system use root@mydomain.com as return address by default? Thank you in advance! nz (1 Reply)
Discussion started by: aixlover
1 Replies

9. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

10. Shell Programming and Scripting

Return: can only `return' from a function or sourced script

Not sure where the problem is. I can run the script without any issue using the following command. . /opt/app/scripts/cdc_migration.sh But it fails with the below error when I try it this way /opt/app/scripts/cdc_migration.sh /opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies
6to4relay(1M)						  System Administration Commands					     6to4relay(1M)

NAME
6to4relay - administer configuration for 6to4 relay router communication SYNOPSIS
/usr/sbin/6to4relay /usr/sbin/6to4relay [-e] [-a addr] /usr/sbin/6to4relay [-d] /usr/sbin/6to4relay [-h] DESCRIPTION
The 6to4relay command is used to configure 6to4 relay router communication. Relay router communication support is enabled by setting the value of a variable that stores an IPv4 address within the tun module. This variable is global to all tunnels and defines the policy for communication with relay routers. By default, the address is set to INADDR_ANY (0.0.0.0), and the kernel interprets the value to indicate that support for relay router communication is disabled. Otherwise, support is enabled, and the specified address is used as the IPv4 des- tination address when packets destined for native IPv6 (non-6to4) hosts are sent through the 6to4 tunnel interface. The 6to4relay command uses a project private ioctl to set the variable. 6to4relay used without any options outputs the current, in-kernel, configuration status. Use the -a option to send packets to a specific relay router's unicast address instead of the default anycast address. The address specified with the -a option does not specify the policy for receiving traffic from relay routers. The source relay router on a received packet is non-deterministic, since a different relay router may be chosen for each sending native IPv6 end-point. Configuration changes made by using the 6to4relay are not persistent across reboot. The changes will persist in the kernel only until you take the tunnel down OPTIONS
The 6to4relay command supports the following options: -a addr Use the specified address, addr. -e Enable support for relay router. Use -a addr if it is specified. Otherwise, use the default anycast address, 192.88.99.1. -d Disable support for the relay router. -h Help OPERANDS
The following operands are supported: addr A specific relay router's unicast address. addr must be specified as a dotted decimal representation of an IPv4 address. Otherwise, an error will occur, and the command will fail. EXAMPLES
Example 1 Printing the In-Kernel Configuration Status Use /usr/sbin/6to4relay without any options to print the in-kernel configuration status. example# /usr/sbin/6to4relay If 6to4 relay router communication is disabled, the administrator will see the following message: 6to4relay: 6to4 Relay Router communication support is disabled. If 6to4 router communication is enabled, the user will see this message: 6to4relay: 6to4 Relay Router communication support is enabled. IPv4 destination address of Relay Router = 192.88.99.1 EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/usr/sbin/6to4relay The default installation root ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ifconfig(1M), attributes(5) Huitema, C. RFC 3068, An Anycast Prefix for 6to4 Relay Routers. Network Working Group. June, 2001. Carpenter, B. and Moore, K. RFC 3056, Connection of IPv6 Domains via IPv4 Clouds. Network Working Group. February, 2001. DIAGNOSTICS
The 6to4relay reports the following messages: 6to4relay: input (0.0.0.0) is not a valid IPv4 unicast address Example: The following example provides an incorrect unicast address. example# 6to4relay -e -a 0.0.0.0 Description: The address specified with the -a option must be a valid unicast address. 6to4relay: option requires an argument -a usage: 6to4relay 6to4relay -e [-a <addr>] 6to4relay -d 6to4relay -h Example: The following example does not include an argument for the -a option. example# 6to4relay -e -a Description: The -a option requires an argument. usage: 6to4relay 6to4relay -e [-a <addr>] 6to4relay -d 6to4relay -h Example: The following example specifies options that are not permitted. example# 6to4relay -e -d Description: The options specified are not permitted. A usage message is output to the screen. usage: 6to4relay 6to4relay -e [-a <addr>] 6to4relay -d 6to4relay -h Example: The following example specifies the -a option without specifying the -e option. example# 6to4relay -a 1.2.3.4 Description: The -e option is required in conjunction with the -a option. A usage message is output to the screen. 6to4relay: ioctl (I_STR) : Invalid argument Example: The following example specifies an invalid address. example# 6to4relay -e -a 239.255.255.255 Description: The address specified with the -a option must not be a class d addr. SunOS 5.11 19 Nov 2002 6to4relay(1M)
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy