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 HPUX
wcstof
wcstod(3C)wcstod(3C)NAME
wcstod(), wcstof(), wcstold() - convert a wide character string to a double-precision number
SYNOPSIS
Itanium(R)-based Systems Only
Remarks
These functions are compliant with the UNIX standard Worldwide Portability Interface wide-character formatting functions. They parallel
the 8-bit character formatting functions defined in strtod(3C), strtold(3C) and strtof(3C) respectively.
DESCRIPTION
The and functions return the value represented by the wide-character string pointed to by nptr as a double-precision floating-point number,
single-precision floating-point number, and long double-precision number, respectively. The wide character string is scanned (leading
white-space characters as defined by in wctype(3C) are ignored) up to the first unrecognized character. If no conversion can take place,
zero is returned.
The and functions recognize wide characters in the following sequence:
1. An optional string of white space wide characters, which are ignored
2. An optional sign followed by one of the following:
o A string of digits optionally containing a radix character, then an optional or followed by an optional sign or
space, followed by an integer
o A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally containing a radix character, then an optional
binary exponent part
o One of INF or INFINITY, or any other wide string equivalent except for case
o One of NAN or NAN(n-wchar-sequence), or any other wide string ignoring case in the NAN part, where n-wchar-sequence is:
o digit
o nondigit
o n-wchar-sequence digit
o n-wchar-sequence nondigit
The radix character is determined by the current environment (see setlocale(3C)). If has not been called successfully, the default envi-
ronment, "C", is used (see lang(5)). The default environment specifies a period (.) as the radix character.
If the value of endptr is not the variable to which it points is set to point at the wide character after the last number, if any, that was
recognized. If no number can be formed, is set to nptr, and zero is returned.
EXTERNAL INFLUENCES
Environment Variables
determines the value of the radix character within the currently loaded environment.
determines how wide character codes are interpreted.
International Code Set Support
Single- and multibyte character code sets are supported.
RETURN VALUE
If the correct value would cause overflow, or is returned (according to the sign of the value), and is set to
If the correct value would cause underflow, zero is returned and is set to
If encounters an input wide character string equal to or (both case insensitive) it will return If encounters an input wide character
string equal to or (both case insensitive) it will return
AUTHOR
was developed by AT&T and HP. and were developed by HP.
SEE ALSO scanf(3S), setlocale(3C), wcstol(3C), wctype(3C), lang(5), thread_safety(5), glossary(9).
STANDARDS CONFORMANCE wcstod(3C)