What I want is just the IP address, no line breaks before or after, in a variable that I can then insert into my local host file, after some tweaking of adding my desired access domain to it.
Command substitution trims trailing newlines, so I don't even understand how you're having a problem with a trailing newline(s) in a variable whose value is assigned from command substitution.
In the following shell session, while the first printf statement generates 5 trailing newlines (verified with od), not a single one is assigned to the variable $v (again, verified with od). If your shell does not work this way, then it's an egregious violation of the posix standard. It's more likely that you are doing something wrong when you are accessing/printing the variable's value:
Regards,
Alister
I'm trying to find a command that will trim the white space off a string.
e.g.
$str = " stuf "
$str = trim ( $str )
echo $str // ouput would just be stuf
Thanks, Mark (4 Replies)
All,
I'm a newbie at shell scripting and regular expressions and I just need to take a file that's arranged like the one below, remove all leading and trailing whitespace and add a line break after each word. I've been able to remove a few spaces using various awk, sed and Perl scripts, but... (7 Replies)
Hi Friends,
Can any one help with this issue:
How to trim spaces for each line at the end,
Like I have a file in this format.
EMP1 SMITH 46373 5 STREET HOWARD 74636
EMP2 JONES 5454 { these are spaces ........}
EMP3 SMITH 46373 5 STREET HOWARD 74636
EMP4 JON 2554 { these are... (1 Reply)
Hello,
I am passing a filename to a script to draw parameters from it. However, I want to use part of the filename as a parameter. The filename is transfer_ccf_3731_10.sh but I only need the 3731_10 part of it.
Is this possible? Any help or suggestions would be appreciated!
Regards,
J. (4 Replies)
Hi All,
I am using trim in my code..
ID_SA_SOURCE="`echo "$data" | cut -c17-34 | tr -s " "`"
ID_SA_DEST="`echo "$data" | cut -c35-52 | tr -s " "`"
echo"$ID_SA_SOURCE";"$ID_SA_DEST";
the output is
0608166896; 3001339; contains one whitespace between the two ..how can i remove that single... (3 Replies)
Hi all,
I've been looking for how to eliminate blank spaces in a variable or strings. I've seen several ways, using sed, awk and even python. One of them is use 'tr' command, but it does not work as I expected: For example:
echo " stuff " | tr -s " "leaves one space ahead and another... (3 Replies)
To trim 3rd field in for all the lines of a file and replace the modified string in that particular field.
For example i have a file called Temp.txt having content
Temp.txt
-----------------
100,234,M1234
400,234,K1734
300,345,T3456
----------------
So the modified file output should... (4 Replies)
FOLKS ,
i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one.
thanks...
Venu (3 Replies)
Hi All,
I have a file named as
FAB1_600015_CONRAD.A0_7XYZ12345.000_LT-SWET.01_LTPA25L_20110622-161429_07_WFR12345_20110622-161429_20110712-125228.data.dis
I want to generate a directory taking only the 7XYZ12345.000_WFR12345
The length and format of the Filename will be the same... (2 Replies)
Discussion started by: asheshrocky
2 Replies
LEARN ABOUT SUSE
udhcpc
UDHCPC(8) GNU/Linux Administrator's Manual UDHCPC(8)NAME
udhcpc - very small DHCP client
SYNOPSIS
udhcpc [OPTION]...
DESCRIPTION
The udhcp client negotiates a lease with the DHCP server and executes a script when it is obtained or lost.
OPTIONS -c CLIENTID, --clientid=CLIENTID
Send the client identifier CLIENTID.
-f, --foreground
Do not fork after obtaining a lease.
-H HOSTNAME, --hostname=HOSTNAME
Send the client hostname HOSTNAME.
-h HOSTNAME
Alias for -H HOSTNAME.
-i INTERFACE, --interface=INTERFACE
Configure INTERFACE.
-n, --now
Exit with failure if a lease cannot be obtained.
-p FILE, --pidfile=FILE
Write the process ID of the daemon to FILE.
-q, --quit
Exit after obtaining a lease.
-r ADDRESS, --request=ADDRESS
Request IP address ADDRESS.
-s FILE, --script=FILE
Use script FILE.
-v, --version
Display version.
USAGE
When an event occurs, udhcpc executes a script. There are four possible arguments to this script:
deconfig
deconfig is used when udhcpc starts, and when a lease is lost. The script should put the interface in an up, but deconfigured,
state.
bound bound is used when udhcpc moves from an unbound to a bound state. The script should configure the interface and set any other rele-
vant parameters (e.g., default gateway, dns server, etc.).
renew renew is used when udhcpc when a lease is renewed. The interface is already configured, so the IP address will not change. Other
parameters (e.g., default gateway, subnet mask, dns server) may.
nak nak is used when udhcpc receieves a NAK packet from the server. The enviromental variable $message will contain the reason for the
NAK message if the server included one. Processing this message is optional, as the script will also be called with deconfig if need
be.
Parameters are passed to the script via the following environment variables:
HOME The inherited HOME, or "/" if it is unset.
PATH The inherited PATH, or "/bin:/usr/bin:/sbin:/usr/sbin" if it is unset.
interface
The interface.
ip The client IP address.
siaddr The BOOTP next server option.
sname The BOOTP server name option.
boot_file
The BOOTP boot file option.
subnet The subnet mask.
timezone
The timezone offset from UTC in seconds.
router The list of routers.
timesvr
The list of time servers.
namesvr
The list of IEN 116 name servers.
dns The list of DNS servers.
logsvr The list of MIT-LCS UDP log servers.
cookiesvr
The list of RFC 865 cookie servers.
lprsvr The list of LPR servers.
hostname
The host name.
bootsize
The length in 512-octet blocks of the bootfile.
domain The domain name of the network.
swapsvr
The client's swap server.
rootpath
The path of the client's root dist.
ipttl The TTL.
mtu The MTU.
broadcast
The broadcast address.
ntpsrv The list of NTP servers.
wins The list of WINS servers.
lease The lease time in seconds.
dhcptype
The DHCP message type (safely ignored).
serverid
The server IP address.
message
Reason for a DHCPNAK.
tftp The TFTP server name.
bootfile
The bootfile name.
FILES
/usr/share/udhcpc/default.script
Script run when leases are obtained or lost.
NOTES
udhcpc responds to the following signals:
SIGUSR1
This signal causes udhcpc to renew the current lease or, if it does not have one, obtain a new lease.
SIGUSR2
This signal caused udhcpc to release the current lease.
GNU /Linux 2001-09-26 UDHCPC(8)