I've asked a similiar question to this, but this time it is different, a little more restrictive....I have a variable, $varib, that should always only contain numeric characters. I need a way to echo something if the variable contains a letter, space, or some other punctuation character, ,.!>?" etc.
Previously I used: grep '[a-zA-Z]' and that can work for letters, but what about the other characters?
quick question, I am trying to run this simple equation
expr 2048 / 2.354
but get a "expr: non-numeric argument" error when ever its run. I believe it may be caused by the decimal point but I do not know how to remedy it. (3 Replies)
Hi,
How can I check numeric value in shell?
I am passing one parameter (integer) and I want to restrict any other characters except 0-9.
./script xyz 10
Here 2nd parameter (10) should be integer only.
Can anyone help on this?
Malay (6 Replies)
Hi,
How to check whether an input to a shell script contain only numeric values.
Is there any way to check against the following characters.
&
(
)
|
\
"
'
<
>
`
I've used the following way.
echo $1 | grep "\{2\}$"
if
then (12 Replies)
Is there a simple way of determining whether a command line arguement is numeric or not?? I tried a search and didn't find anything similar...
This is the 2nd time I've made this post.... It didn't appear that the first one showed up ??
Sorry if this is a duplicate... (1 Reply)
Is there an easy way using a command or other routine for testing whether an argument on the command line is numeric? Just want to validate... I ran a search and didn't find a similar question....
Thx (3 Replies)
Hi everyone, I want my script to check if the first argument has only numbers or not. Im not sure what im doing wrong.
This is how it looks like:
if *") ]
then
echo 'The first arguement should only be in numeric' 1>&2
exit 1
else
exit 0
fi (7 Replies)
Can someone tell me how to change the first column in a very large 17k line file from a random 10 digit numeric value to a non numeric value. The format of lines in the file is:
1702938475,SNU022,201004
the first 10 numbers always begin with 170 (6 Replies)
Using shell,
I have a variable, how can I check that variable for a numeric value such as "41.0"? My program needs to do one things if the numeric value is found, and another if something else such as a string of letter is found. is there a specific character that denotes a numeral? The... (2 Replies)
I want to calculate the following expression in script:
val=179584.0
($val *3*16384)/(1073741824)
$val will have a floating value.
Thanks!
I tried with following:
n=$(echo |awk '{ print $val*3*16384 }')
n=$(echo |awk '{ v=$val; print $v*3*16384 }')
expr $val \* 3.0 \*... (10 Replies)
Discussion started by: karumudi7
10 Replies
LEARN ABOUT ULTRIX
xlator_call
xlator_call(8) System Manager's Manual xlator_call(8)Name
xlator_call - shell script to invoke PostScript translators
Syntax
xlator_call datatype orientation pagesize width length indent
Description
This Bourne shell script can be called by the line printer daemon to invoke the appropriate translator to convert each data type to Post-
Script. The data type passed by may be specified by using the command with the -Ddatatype option, or by using the Da=datatype capability
in the file.
For a file in a data syntax to be translated to PostScript, the script must contain a case branch which recognizes the data type string and
calls a suitable filter. The supplied recognizes the ANSI, ASCII, ReGIS and Tektronix 4014 data types.
Arguments
datatype
The valid data types are: or any other for which a translator has been installed.
orientation
The valid orientations are: portrait or landscape.
pagesize
The valid page sizes are: or
width
The width (in characters) of the page.
length
The length (in lines) of the page.
indent
The amount (in spaces) the output is to be indented.
All the valid arguments are described in detail by the reference page.
Examples
An example shell script is shown below:
case $datatype in
ansi)
exec ansi_ps -F $pagesize -O $orientation -e "$@";;
ascii)
echo "( 04) cvn {} def"
exec ln03rof -w$width -l$length -i$indent;;
postscript)
exec cat;;
tek4014)
exec tek4014_ps -F $pagesize -O $orientation;;
regis)
exec regis_ps -F $pagesize -O $orientation;;
*)
echo "$0: Translator for data type $datatype not installed" >&2
esac
When the shell script is called, the path searched is:
/usr/local/lib/lpdfilters:/usr/ucb:/bin:/usr/bin:
/usr/lib:/usr/lib/lpdfilters
Files
The script
See Alsolno3rof(8), printcap(5), ansi_ps(8), lpd(8)xlator_call(8)