08-04-2011
I use ksh88 and serveral ksh93 versions on Solaris and OpenSolaris.
The problem in my case seems to be, that ${#varname} counts bytes per design and not characters. If you are in a single byte locale, like iso-8859, then everything is fine, because every character uses exactly one byte.
Get me right, I don't think, this is a bug. I am just asking, if someone is aware of a construct in kornshell 88 or at least 93, that counts characters in every scenario.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
pls help me in finding the length of the given string,
do we need to write a code seperately or is there any command??
pls help. (3 Replies)
Discussion started by: vasikaran
3 Replies
2. Shell Programming and Scripting
Hi guys, I hope you can help me with my problem.
I have a text file that contains lines like this:
78 ANGELO -809.05
79 ANGELO2 -5,000.06
I need to find all occurences of amounts that are negative and replace them with x's
78 ANGELO xxxxxxx
79... (4 Replies)
Discussion started by: amangeles
4 Replies
3. Shell Programming and Scripting
Hello All,
Plz help me with:
I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it... (9 Replies)
Discussion started by: ozzy80
9 Replies
4. UNIX for Dummies Questions & Answers
Hi
lets say i have a variable
output="string"
how can you find the length of the string contained in this variable? i guess "wc" cannot be used. its only for files. (8 Replies)
Discussion started by: silas.john
8 Replies
5. Programming
Helo,
I have character array of sixe 128
char filename
now I have one problem that when I enter filename as nothing I got value
as " " ",`\0` " .
when I find this string length ( " ",`\0`) as 1(one).
actually I want to make this length as zero.
so what should I do (10 Replies)
Discussion started by: amitpansuria
10 Replies
6. UNIX for Dummies Questions & Answers
HI
In my script, i am reading the input from the user and want to find the length of the string.
The input may contain leading spaces. Right now, when leading spaces are there, they are not counted.
Kindly help me
My script is like below. I am using the ksh.
#!/usr/bin/ksh
echo... (2 Replies)
Discussion started by: dayamatrix
2 Replies
7. Shell Programming and Scripting
let image that we have string:
QQQQQQQ:ABCDE:FFFFFF:GGGGG
in second field can be 0 or 5 characters
if A exist i need set variable ex: VAR=yes
if B exist i need set variable ex: VAR1=yes
if C exist i need set variable ex: VAR2=yes
etc ...
if second field is empty no variable to set
if... (4 Replies)
Discussion started by: vikus
4 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I need some help.
How can I list files starting with p or f and with the exact length of 3 characters? (2 Replies)
Discussion started by: airbebe
2 Replies
9. UNIX for Dummies Questions & Answers
Hi
I have a file which has sequences which look like this
>String1
aqwertrtrytytyuuijhgddfghhhghhgjhjhhsswekrkmygppdslxmvbnhkwqalldrtjbllnlnlnnnvc
>String2
qwwerrtyuiopasdfghjmnbvfklzxerbvcwghjjkoowwqerrtggbddqsdfgaqwcxzakjtyugfsdefrtgyhujiknbbbbcdcdcxsxsx zxzxcvcfcdcg
>String3... (5 Replies)
Discussion started by: sa@@
5 Replies
10. Shell Programming and Scripting
Hi All,
One of my source file is having Date column and the format of the column is YYYY-MM-DD. As per my business logic I have to check if the date format either YYY-MM-DD or YYYY-M-DD. If any records are in this format then I have print all the records and send those invalid records through... (4 Replies)
Discussion started by: suresh_target
4 Replies
LEARN ABOUT MOJAVE
encode::byte
Encode::Byte(3pm) Perl Programmers Reference Guide Encode::Byte(3pm)
NAME
Encode::Byte - Single Byte Encodings
SYNOPSIS
use Encode qw/encode decode/;
$greek = encode("iso-8859-7", $utf8); # loads Encode::Byte implicitly
$utf8 = decode("iso-8859-7", $greek); # ditto
ABSTRACT
This module implements various single byte encodings. For most cases it uses x80-xff (upper half) to map non-ASCII characters.
Encodings supported are as follows.
Canonical Alias Description
--------------------------------------------------------------------
# ISO 8859 series
(iso-8859-1 is in built-in)
iso-8859-2 latin2 [ISO]
iso-8859-3 latin3 [ISO]
iso-8859-4 latin4 [ISO]
iso-8859-5 [ISO]
iso-8859-6 [ISO]
iso-8859-7 [ISO]
iso-8859-8 [ISO]
iso-8859-9 latin5 [ISO]
iso-8859-10 latin6 [ISO]
iso-8859-11
(iso-8859-12 is nonexistent)
iso-8859-13 latin7 [ISO]
iso-8859-14 latin8 [ISO]
iso-8859-15 latin9 [ISO]
iso-8859-16 latin10 [ISO]
# Cyrillic
koi8-f
koi8-r cp878 [RFC1489]
koi8-u [RFC2319]
# Vietnamese
viscii
# all cp* are also available as ibm-*, ms-*, and windows-*
# also see L<http://msdn.microsoft.com/en-us/library/aa752010%28VS.85%29.aspx>
cp424
cp437
cp737
cp775
cp850
cp852
cp855
cp856
cp857
cp860
cp861
cp862
cp863
cp864
cp865
cp866
cp869
cp874
cp1006
cp1250 WinLatin2
cp1251 WinCyrillic
cp1252 WinLatin1
cp1253 WinGreek
cp1254 WinTurkish
cp1255 WinHebrew
cp1256 WinArabic
cp1257 WinBaltic
cp1258 WinVietnamese
# Macintosh
# Also see L<http://developer.apple.com/technotes/tn/tn1150.html>
MacArabic
MacCentralEurRoman
MacCroatian
MacCyrillic
MacFarsi
MacGreek
MacHebrew
MacIcelandic
MacRoman
MacRomanian
MacRumanian
MacSami
MacThai
MacTurkish
MacUkrainian
# More vendor encodings
AdobeStandardEncoding
nextstep
hp-roman8
DESCRIPTION
To find how to use this module in detail, see Encode.
SEE ALSO
Encode
perl v5.18.2 2013-11-04 Encode::Byte(3pm)