Sponsored Content
Top Forums Shell Programming and Scripting last character is digit or alphabet! Post 302597548 by Scrutinizer on Friday 10th of February 2012 03:26:46 PM
Old 02-10-2012
Try:
Code:
case $x in
  *[A-Za-z]) echo "last character alpha";;
  *[0-9])    echo "last character numeric";;
esac

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What can i do to check that the input is all alphabet.. ?

What can i do to check that the input is all alphabet.. ? (4 Replies)
Discussion started by: XXXXXXXXXX
4 Replies

2. Shell Programming and Scripting

Replace one digit by two digit using sed

Folks, Is there a simple way to replace one digit by two digit using sed. Example, mydigit1918_2006_8_8_lag1.csv should be mydigit1918_2006_08_08_lag01.csv. I tried this way, but doesn't work. echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/' Thank you, (5 Replies)
Discussion started by: Jae
5 Replies

3. Shell Programming and Scripting

How to convert a 2 digit to 4 digit

Hi All, How can i convert a number 24 to 0024 In the same way how can i convert 123 to 0123? All this has to be done inside a script Thanks in advance JS (6 Replies)
Discussion started by: jisha
6 Replies

4. Shell Programming and Scripting

To check if the first character is a alphabet or number

Hi, I need to find whether the first character in a line is a alphabet or a number. If its a number i should sort it numerically. If its a alphabet i should sort it based on the ASCII value.And if it is something other than alphabet or number then sort it based on ASCII value. The code i used... (2 Replies)
Discussion started by: ragavhere
2 Replies

5. Shell Programming and Scripting

Single digit date to double digit date.

I have a var storing date var=`date` Now the date is returned as Mon Feb 2 00:25:48 PST 2009 Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var" My intention in above case is... (3 Replies)
Discussion started by: villain41
3 Replies

6. Shell Programming and Scripting

awk length of digit and print at most right digit

Have columns with digits and strings like: input.txt 3840 3841 3842 Dav Thun Tax Cahn 146; Dav. 3855 3853 3861 3862 Dav Thun Tax 2780 Karl VI., 3873 3872 3872 Dav Thun Tax 3894 3893 3897 3899 Dav Thun Tax 403; Thun 282. 3958 3959 3960 Dav Thun Tax 3972 3972 3972 3975 Dav Thun Tax... (8 Replies)
Discussion started by: sdf
8 Replies

7. Shell Programming and Scripting

Alphabet counting

I have a text file in the following format CCCCCGCCCCCCCCCCcCCCCCCCCCCCCCCC AAAATAAAAAAAAAAAaAAAAAAAAAAAAAAA TGTTTTTTTTTTTTGGtTTTTTTTTTTTTTTT TTTT-TTTTTTTTTCTtTTTTTTTTTTTTTTT Each row/line will have 32 letters and each line will only have multiple occurrences of 2 letters out of a pool... (1 Reply)
Discussion started by: Lucky Ali
1 Replies

8. Shell Programming and Scripting

convert two digit in to single digit...

Hi Guys. My Input: ABCD 12 00 KL ABCD 12 08 DL ABCD 12 10 KK ABCD 12 04 LL ABCD 13 00 LP ABCD 13 1O LS Output: ABCD 12 0 KL ABCD 12 8 DL ABCD 12 10 KK ABCD 12 4 LL ABCD 13 0 LP (2 Replies)
Discussion started by: pareshkp
2 Replies

9. Shell Programming and Scripting

Recode alphabet into numbers

I have a genotype.bim file where it contains information about SNPs and genotype. As a hypothetical example, let's say genotype.bim snp1 ... A G snp2 ... G T snp3 ... G T snp4 ... G A ... snpN ... C G where first column identifies each SNP and 5th and 6th column has genotype... (3 Replies)
Discussion started by: johnkim0806
3 Replies

10. Shell Programming and Scripting

Conditional for every letter in alphabet

I wanted to know if there was a more efficient to do this. I was to setup a conditional for every letter of the alphabet, like so (I am parsing an array): for i in "${arr}"; do if ]; then echo "$i starts with A" else echo "$i does not start with A" fi done I want to do this A-Z, is there... (6 Replies)
Discussion started by: sudo
6 Replies
ISWDIGIT(3)						     Linux Programmer's Manual						       ISWDIGIT(3)

NAME
iswdigit - test for decimal digit wide character SYNOPSIS
#include <wctype.h> int iswdigit(wint_t wc); DESCRIPTION
The iswdigit() function is the wide-character equivalent of the isdigit(3) function. It tests whether wc is a wide character belonging to the wide-character class "digit". The wide-character class "digit" is a subclass of the wide-character class "xdigit", and therefore also a subclass of the wide-character class "alnum", of the wide-character class "graph" and of the wide-character class "print". Being a subclass of the wide character class "print", the wide-character class "digit" is disjoint from the wide-character class "cntrl". Being a subclass of the wide-character class "graph", the wide-character class "digit" is disjoint from the wide-character class "space" and its subclass "blank". Being a subclass of the wide-character class "alnum", the wide-character class "digit" is disjoint from the wide-character class "punct". The wide-character class "digit" is disjoint from the wide-character class "alpha" and therefore also disjoint from its subclasses "lower", "upper". The wide-character class "digit" always contains exactly the digits '0' to '9'. RETURN VALUE
The iswdigit() function returns nonzero if wc is a wide character belonging to the wide-character class "digit". Otherwise it returns zero. CONFORMING TO
C99. NOTES
The behavior of iswdigit() depends on the LC_CTYPE category of the current locale. SEE ALSO
isdigit(3), iswctype(3) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
1999-07-25 ISWDIGIT(3)
All times are GMT -4. The time now is 01:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy