Remove a character and assign result to a variable
I am reading lines from a file that contain a number sign (#) before a three or four digit number:
I can remove the '#' and get just the number. However, I then want to assign that number to a variable and use it as part of a path further on in my program:
print -n {$second#?} gives me the 1043 but I have been unsuccessful assigning this result to a variable - I tried company = {$second#?} but company has no value.
I'm new to this, so any help would be appreciated.
Last edited by Don Cragun; 06-19-2015 at 09:25 PM..
Reason: Add CODE AND ICODE tags.
Hi,
I'm quite new to scripting and I want to modify following line of an existing script:
MYVAR=`subst |grep 'L:\\\:' | sed -e 's/.*\\\//'`;
What I have to do is to use the content of a variable instead of the constant expression 'L:\\\:' as the grep string to be matched.
Assuming I already... (5 Replies)
How...
can I read input by a user character by cahracter. And assign each character from the string to a variable?
Any help would be greatly appreciated!
Thank you! (1 Reply)
Hi Friends...
Please assist me to assign the result of a SQL query that results two column, to two variables.
Pls find the below code that I write for assigning one column to one variable. and please correct if anything wrong..
#! /bin/sh
no='
sqlplus -s uname/password@DBname... (4 Replies)
Hi friends,
firstly, i can run following expression and i took 100 value.
sqlplus -s username/password@TTTEST @umt.sql
umt.sql exists "select t.deger from parametre t where t.id=30".
result of this query =100
i need to assign this value(100) to variable(for example x... (2 Replies)
Hi
im trying to assign the result of the db2 command to a variable inside a shell script...
: tab_cnt=`db2 "select count(*) from syscat.tables where tabname = 'ABC' and tabschema = 'MATT01'" |head -4|tail +4|cut -c 11`
: echo $tab_cnt
when i echo im getting a blank value.. im expecting... (1 Reply)
I see a millioin ways to do this with echo, but what I wan to do is assign a variable the "nth" character of an incoming parameter to a ksh script.
$1 will be "pia"
I need to assign the first character to stmttype. (10 Replies)
Hi,
I have the following command that lists all the .o files from all the directories except of vwin (which I don't want it)
for i in `ls -d */*.o|awk '$0 !~ "vwin"'`; do echo $i; done
The result is something like that
dir1/file1.o
dir1/file2.o
dir2/file3.o
etc.
So, I want to create a... (9 Replies)
Hello,
I have searched but failed to find what exactly im looking for,
I need to eliminate first "." in a output so i can use something like the following
echo "./abc/20141127" | nawk '{gsub("^.","");print}'
what i want is to use gsub result later on, how could i achieve it?
Let say... (4 Replies)
Hi
How to pass echo output to a variable ?
Does below awk command will get the last character of hostname and assign to a variable - "svr" ?
svr=$( echo `hostname` | awk '{print substr($0,length,1)}' )
Thanks.
Please use CODE tags when dsplaying code segments, sample input, and sample... (7 Replies)
Discussion started by: Lim
7 Replies
LEARN ABOUT OSF1
namepool
namepool(4) Kernel Interfaces Manual namepool(4)NAME
namepool - DHCP server database
DESCRIPTION
The namepool database provides joind with names that are available for dynamic assignment to clients of the DHCP protocol. For each DHCP
server and domain name (NIS or DNS), the database contains a collection of names available for allocation to DHCP clients within those
domains. One name plays a distinguished role - it is used as a prefix when the pool has been exhausted. Names are generated from the pre-
fix by appending a number, 1,2.., and a trailing 'd'. The namepool file is read whenever joind starts. Names within the database must not
be allocated to hosts which are not DHCP clients, and if the administration of a domain is shared between several DHCP servers, the name-
pools that each has must be disjoint. Names may be added and removed from the namepool file. If a name is removed from the file it remains
bound to the client to which it was allocated; if no such binding is in effect the name is excised from the server's pool the next time the
server starts. Once a name is dynamically bound to a host it will never be reused even if that host subsequently acquires a new name, but
there is no need to remove it from namepool.
FORMAT
Blank lines and lines beginning with a number sign (#) are ignored. A new entry must begin in column one and has one of the following for-
mats:
domain server
domain server name_prefix
The domain variable is the domain in which the names which follow are assigned.
The server variable is the name or IP address of the server in charge of allocating these names to clients.
The prefix variable is the prefix that will be used when the pool is exhausted.
Succeeding lines contain one or more names for domains that are to be allocated by the server. Each of these succeeding lines must begin
with at least one white space character.
FILES
/etc/join/namepool
RELATED INFORMATION joind(8), join.ipaddresses(4) delim off
namepool(4)