How to find that a given variable is a number or character?
e.g.
echo "Enter the number"
read var
If "$var" is a number then display "Number has been entered"
else display "Character has been entered".
Thanking you in advance (3 Replies)
I'm having a problem when the first line or first character of a file is blank. I need to get rid of both of them when they occur but don't want to delete the line. Does anyone have any suggestions? (7 Replies)
Currently my script works like this:
DATE_dd=5 # Assume this is user input. (User can enter 1, 2, 3, .. 10, 11, 12)
if ; then
DATE_D=" ${DATE_dd}"
file_name="${DATE_yyyy}${DATE_mm}0${DATE_dd}.csv"
else
DATE_D=${DATE_dd}
... (7 Replies)
how can i check whether variable contains only character from a-z or A-Z....if my variable contains any alpha numeric, numeric or any character with some special one i.e. *%&@! etcetera etcetera....then it should show me please enter only characters......
Let my variable
var1="abc77}|"
then... (9 Replies)
i am a newbie to shell script,so i want a kshell script in which i need to check for a particular character inside a file through conditional looping(like if ,case,while)and if that character exists ,then substitute a given character to that character.
consider a file test.txt,inside the file... (1 Reply)
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)
Below is the abstract of the script which is working fine.
if ]
then
error_process "Invalid month format."
return 1
fi
I am doing validation for month and it errors if the value is > 12 or < 0. In addition, I want to add another condition to error if it... (2 Replies)
Hi,
I have a variable and to it always alphanumeric value will be assigned.
If the value has any special characters in it then in the if statement it should exit like below
if (value has any speacial character)
then
exit
else
....
fi
can any one suggest how to acheive this? (4 Replies)
Hello,
I have a text file with n lines in the following format (9 column fields):
Example:
contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c
I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Hi,
Please see the below information.
1. Read files one by one and run the script.
2. Check if the filename is CHARTER OR NUMBER
3. Run the case statement.
I have files in the folder. i will get 300 files in a single day.
Abc_111111111111.csv
101010_kkk_bbbb.csv... (6 Replies)
Discussion started by: onesuri
6 Replies
LEARN ABOUT REDHAT
charmap
charmap(5) Linux User Manual charmap(5)NAME
charmap - character symbols to define character encodings
DESCRIPTION
A character set description (charmap) defines a characterset of available characters and their encodings. All supported character sets
should have the portable character set as a proper subset.
SYNTAX
The charmap file starts with a header, that may consist of the following keywords:
<codeset>
is followed by the name of the codeset.
<mb_cur_max>
is followed by the max number of bytes for a multibyte-character. Multibyte characters are currently not supported. The default
value is 1.
<mb_cur_min>
is followed by the min number of bytes for a character. This value must be less or equal than mb_cur_max. If not specified, it
defaults to mb_cur_max.
<escape_char>
is followed by a character that should be used as the escape-character for the rest of the file to mark characters that should be
interpreted in a special way. It defaults to the backslash ( ).
<comment_char>
is followed by a character that will be used as the comment-character for the rest of the file. It defaults to the number sign ( #
).
The charmap-definition itself starts with the keyword CHARMAP in column 1.
The following lines may have one of the two following forms to define the character-encodings:
<symbolic-name> <encoding> <comments>
This form defines exactly one character and its encoding.
<symbolic-name>...<symbolic-name> <encoding> <comments>
This form defines a couple of characters. This is only useful for mutlibyte-characters, which are currently not implemented.
The last line in a charmap-definition file must contain END CHARMAP.
SYMBOLIC NAMES
A symbolic name for a character contains only characters of the portable character set. The name itself is enclosed between angle brack-
ets. Characters following an <escape_char> are interpreted as itself; for example, the sequence '<\>>' represents the symbolic name '>'
enclosed in angle brackets.
CHARACTER ENCODING
The encoding may be in each of the following three forms:
<escape_char>d<number>
with a decimal number
<escape_char>x<number>
with a hexadecimal number
<escape_char><number>
with an octal number.
FILES
/usr/share/i18n/charmaps/*
AUTHOR
Jochen Hein (jochen.hein@delphi.central.de)
CONFORMING TO
POSIX.2
SEE ALSO locale(1), localedef(1), setlocale(3), localeconv(3), locale(5)National Language Support 1994-11-28 charmap(5)