Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Ksh How to test if variable is numeric?? Post 302183666 by developncode on Wednesday 9th of April 2008 04:07:51 PM
Old 04-09-2008
I was able to get it to work...sorry it had one leading whitespace that was keeping it from recognizing that the variable was numeric and not a string. Thanks for all your help I really appreciate it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to set a variable to accept alpha-numeric characters?

I am working on a shell program that needs to accept alpha-numeric input (i.e., P00375); when I use a simple 'read' statement to read in the input (i.e., read LOG), I receive the message "p00375: bad number". How must I adjust my input statement to accept alpha-numerics? Thanks! Brent (3 Replies)
Discussion started by: bcaunt
3 Replies

2. Shell Programming and Scripting

ksh - test if string contains alphanumeric...

Okay I will let users input spaces as well :) I am having a mental block. I have done a couple of searches but havent found anything that I understand (the likes of :alpha: and awk). Basically I want to give the user an option to enter some text which will go down as a field within a flat... (3 Replies)
Discussion started by: tugger
3 Replies

3. Shell Programming and Scripting

to check variable if its non numeric

if test $b -ne then echo "\n\n\n\tPassword reset has been done successfully" else echo "\n\n\n\tAn error occurred" fi i want to check whether $b is non-numeric so how to do that? (3 Replies)
Discussion started by: sachin.gangadha
3 Replies

4. Shell Programming and Scripting

Replace variable length numeric string

I have a customer who logged some cc and bank account numbers in their apache logs. I got the cc numbers x'd out with sed -e 's/args=\{16\}/args=XXXXXXXXXXXXXXXX/g' -e 's/cardnum=\{16\}/cardnum=XXXXXXXXXXXXXXXX/g'but that wasn't too difficult due to the value being 16 digits. The bank account... (7 Replies)
Discussion started by: mk4mzid
7 Replies

5. Shell Programming and Scripting

Remove non numeric values from a variable

Hello all, I am working on a basic script but need a little help. Issue: I am running a SQL Query using sqlplus and a shell script. I have the output of the statement stored as variable $A. $A is set to "other text here 45678754 other text here". I need to strip all text except that numeric... (13 Replies)
Discussion started by: ownedthawte
13 Replies

6. Shell Programming and Scripting

KSH: Test telnet and exit

Hi, I need to do a test Telnet in KSH and if the connection is good then disconnect the telnet session with out logging in and without exiting the shell script. Example output of a good connection: $telnet xxx.xx.xx.xxx xxxx Trying xxx.xx.xx.xxx... Connected to xxx.xx.xx.xxx. Escape... (1 Reply)
Discussion started by: calex
1 Replies

7. Shell Programming and Scripting

String variable to numeric conversion in perl

Hi guys I am having this strange issue.Well my requirement is like below Compare two values between flat file and oracle DB Via perl script I am easily getting the rowcount Now I connect sql plus via perl and the column value that returns is string my $sqlplus_settings = ''; my... (7 Replies)
Discussion started by: Pratik4891
7 Replies

8. Shell Programming and Scripting

Assigning numeric values to variable

I have a code like this v_num=9 comp_num=39 if then echo "pass" fi echo "end" I am getting an error ksh: v_num=99 comp_num=39 if then echo "pass" fi echo "end" (3 Replies)
Discussion started by: swayam123
3 Replies

9. Shell Programming and Scripting

How to get a numeric value from Oracle to UNIX variable without spaces?

Hi, I am using the below code to get a numeric value from oracle to unix variable: BD_RC_CNT=`sqlplus -s ${WMD_DM_CONNECT} <<EOF set heading off set pagesize 0 Select count(*) from wmd_bad_data where proc_id = ${PROC_ID} and file_id = ${FILE_ID} and file_dt =... (7 Replies)
Discussion started by: Arun Mishra
7 Replies

10. Shell Programming and Scripting

Checking numeric expression in .ksh script

Gurus, Please need your help. I'm saving a filetimestamp into $filetimestamp and say....echo $filetimestamp gives 2015021612 I'm saving a cutoff_time into $cutoff_time say....echo $cutoff_time gives 2015021514 now my requirement is to check if $filetimestamp is greater than... (4 Replies)
Discussion started by: thummi9090
4 Replies
XUPDATE(1p)						User Contributed Perl Documentation					       XUPDATE(1p)

NAME
xupdate - Process XUpdate commands over an XML document SYNOPSIS
xupdate [options] <xupdate-file> <input-file> Options: -u | --usage print brief help on usage -h | --help print documentation -n | --namespace prefix=namespace-uri associate a namespace with a prefix for use in XPath selections in XUpdate file (this option may occur several times) -k | --keep-ws preserve whitespace in the XUpdate file -s | --strip-ws strip ignorable whitespace from the input file -V | --version print current version and revision -i | --indent indent the output XML -j | --extra-indent like -i, but also adds a leading and a trailing linebreak to every text node. but also put an extra newline after every start-tag and before every end-tag OPTIONS
--usage Print a brief help message on usage and exits. --help Prints the manual page and exits. --namespace prefix=namespace-uri Associate a namespace with a prefix. The prefix may be used in the XPath selections in the XUpdate file to address nodes of the source document that belong to the given namespace. This is especially useful for mapping the default namespace to a prefix because XPath by definition doesn't honour default namespaces. This option may occur several times. --keep-ws Preserves any whitespace in XUpdate file. The default behaviour is to remove all ignorable whitespace and any leading or trailing whitespace in all XUpdate command elements in the XUpdate file. --strip-ws Remove "ignorable" whitespace from the input file. The default behaviour is to keep any whitespace unless the --extra-indent (-j) option is used. Note that the whitespace being present or not may affect results returned by some XPath expressions (such as /foo/bar/text()[2]). --version Print version and revision number of This program command and version number of XML::XUpdate library used. --indent Indent the resulting document on output. --extra-indent Indent the resulting document on output as --indent, but also add a leading and a trailing linebreak to every text node. --debug Print some debugging information about commands being applied. DESCRIPTION
This program will parse the given XUpdate file and the input file and print the input file updated accordingly. XUpdate file format is described in XUpdate Working Draft from 2000-09-14 (http://www.xmldb.org/xupdate/xupdate-wd.html). AUTHOR
Petr Pajas, pajas@matfyz.cz COPYRIGHT
Copyright 2002-2003 Petr Pajas, All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2011-08-02 XUPDATE(1p)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy